public ActionResult Edit(Type type) { if (ModelState.IsValid) { var alreadyEXist = _typeService.CheckIfAlreadyExist(type); if (!alreadyEXist) { _typeService.Update(type); return(RedirectToAction("Index")); } ModelState.AddModelError("Name", $"Type with name {type.Name} already exists"); } return(View(type)); }