public Category UpdateCategory(Category categoryData) { var questCat = _repo.GetQuestCatByCatId(categoryData.Id); if (questCat != null) { throw new Exception("This has a majestic Quest Cat! You shall not edit!"); } var category = _repo.GetById(categoryData.Id); category.Name = categoryData.Name; var updatedCategory = _repo.Edit(category); return(updatedCategory); }