public ActionResult Save(ExpenseCategoryVM view) { ModelState.Remove("Id"); if (ModelState.IsValid) { if (view.Id == 0) { _expenseCategoryRepository.AddToDatabase(view.MapToModel()); } else { _expenseCategoryRepository.UpdateInDatabase(view.MapToModel(), view.Id); } _expenseCategoryRepository.Save(); } return(RedirectToAction("Index")); }