public ActionResult Save(TaskViewModel input) { var task = input.Task.EntityId > 0? _repository.Find <Task>(input.Task.EntityId):new Task(); mapItem(task, input.Task); mapChildren(task, input); ICrudManager crudManager = null; if (task.Complete && !task.InventoryDecremented) { crudManager = _inventoryService.DecrementTaskProduct(task); task.InventoryDecremented = true; } crudManager = _saveEntityService.ProcessSave(task, crudManager); var notification = crudManager.Finish(); return(Json(notification)); }