protected void SaveCategories()
{
XDocument docCategories = new XDocument();
XElement xelRoot = new XElement("categoryManager", new XAttribute("fileVersion", CURRENT_VERSION));
docCategories.Add(xelRoot);
XElement xelCategoryList = new XElement("categoryList");
xelRoot.Add(xelCategoryList);
xelCategoryList.Add(from mct in m_tslCategories
select new XElement("category",
new XAttribute("path", mct.CategoryPath),
new XAttribute("ID", mct.Id),
new XElement("name",
new XText(mct.CategoryName))));
if (!Directory.Exists(Path.GetDirectoryName(CategoryPath)))
Directory.CreateDirectory(Path.GetDirectoryName(CategoryPath));
docCategories.Save(CategoryFilePath);
}