public ActionResult Edit(Car car) { ViewBag.Type = ViewBag.Type = GetCarTypeList(); if (ModelState.IsValid) { try { _carRepo.DeleteMaintainceTasksFromCar(car); _carRepo.AddMaintainceTasksToCar(car.MaintainceTasks); car.MaintainceTasks = null; _carRepo.Update(car); _flashMessenger.Success("Car information saved"); } catch (SystemException e) { _flashMessenger.Error(e.Message); } return(RedirectToAction("Index")); } return(View("Edit", car)); }