private void createAchievementCategory_Click(object sender, RoutedEventArgs e)
 {
     int maxid = (from d in LegacyToolBox.Data.AchievementCategory select d.ID).Max() + 1;
     int uiOrder = (from d in LegacyToolBox.Data.AchievementCategory where d.ParentID == -1 select d.UIOrder).Max() + 1;
     AchievementCategory category = new AchievementCategory(maxid, -1, "New Achievement Category", uiOrder);
     LegacyToolBox.Data.AchievementCategory.Add(category);
     RefreshCategory();
 }
        private void createAchievementSubCategory_Click(object sender, RoutedEventArgs e)
        {
            AchievementCategory category = achievementCategoryList.SelectedItem as AchievementCategory;
            if (category == null)
                return;

            int maxid = (from d in LegacyToolBox.Data.AchievementCategory select d.ID).Max() + 1;
            var uiOrder = from d in LegacyToolBox.Data.AchievementCategory where d.ParentID == category.ID select d.UIOrder;
            int order = uiOrder.Count() == 0 ? 1 : uiOrder.Max() + 1;
            AchievementCategory subCategory = new AchievementCategory(maxid, category.ID, "New Achievement Category(Sub)", order);
            LegacyToolBox.Data.AchievementCategory.Add(subCategory);
            RefreshSubCategory();
        }