public bool CreateCategory(EditCategoryViewModel model, IIdentity identity) { var category = new Category(); category.InjectFrom(model); category.AddedBy = identity.Name; category.AddedDate = DateTime.Now; category.UpdatedBy = identity.Name; category.UpdatedDate = DateTime.Now; if (string.IsNullOrEmpty(category.LID)) { category.LID = category.DisplayTitle.Replace(" ", "-"); } _repository.AddCategory(category); return(_repository.SaveChanges() == 1); }