public static Category CategoryUpdate(Category category)
        {
            category = category.Save();

            FeedService.FeedAdd("Updated", category);

            return category;
        }
        public static Category CategoryInsert(Category category)
        {
            category = category.Save();

            FeedService.FeedAdd("Created", category);

            return category;
        }
        public static bool CategoryDelete(Category category)
        {
            Category.DeleteCategory(
                new CategoryCriteria
                    {
                        CategoryId = category.CategoryId
                    });

            FeedService.FeedAdd("Deleted", category);

            return true;
        }
        public static Category CategorySave(Category category)
        {
            if (!category.IsValid)
            {
                return category;
            }

            Category result;

            if (category.IsNew)
            {
                result = CategoryService.CategoryInsert(category);
            }
            else
            {
                result = CategoryService.CategoryUpdate(category);
            }

            return result;
        }
        public CategoryFormModel Map(Category category, CategoryFormModel model, bool ignoreBrokenRules)
        {
            Csla.Data.DataMapper.Map(category, model, true);

            model.Tab = "Home";
            model.IsNew = category.IsNew;
            model.IsValid = category.IsValid;

            if (!ignoreBrokenRules)
            {
                foreach (var brokenRule in category.BrokenRulesCollection)
                {
                    this.ModelState.AddModelError(string.Empty, brokenRule.Description);
                }
            }

            return model;
        }