public ActionResult Create(Variant newVariant) { string pageAction = "Create"; try { if (ModelState.IsValid) { _vRepository.Add(newVariant); return(RedirectToAction("Edit", new { id = newVariant.Id, fromSave = "Saved" })); } returnModelToEdit(pageAction); return(View("Edit", newVariant)); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); returnModelToEdit(pageAction); return(View("Edit", newVariant)); } }