public IActionResult PatientEdited(EditedPatient patient) { if (ModelState.IsValid) { var client = new ResourceGetter(); if (string.IsNullOrEmpty(patient.Id)) { return(RedirectToAction("Patient", "Home")); } //fetch original patient var originalPatient = client.GetItem <Patient>(patient.Id); if (originalPatient != null) { if (patient.TryMergeWithResource(originalPatient)) { client.UpdateItem(originalPatient); } } } else { return(View("EditPatient", patient)); } return(RedirectToAction("Patient", "Home")); }