public ActionResult Edit(Edition edition) { if (ModelState.IsValid) { //if entity is new, it will not pass through TransferFromTo() and we must attach the serials if(edition.IsTransient() && edition.Limited) for (int i = 1; i <= edition.LimitedQty; i++) edition.LimitedEditionSerials.Add(new LimitedEditionSerial { Edition = edition, Number = i }); var artworkId = edition.Artwork.Id; edition.Artwork = _artworkRepository.Get(artworkId); var confirmation = _editionTasks.SaveOrUpdate(edition); if (confirmation.WasSuccessful) { //edition may have been deleted, orphaning the serials. Search and delete var serialsToDelete = _limitedEditionSerialRepository.GetAll().GetToBeDeleted().ToList(); foreach(var item in serialsToDelete) { _limitedEditionSerialCudTasks.Delete(item.Id); } TempData["message"] = confirmation.Message; return RedirectToAction("Edit", "Artwork", new { id = artworkId }); } ViewData["message"] = confirmation.Message; } return View(_editionTasks.CreateEditViewModel(edition)); }