/// <summary> /// Removes the prescription. /// </summary> /// <param name="selectedItem"></param> public async void DeletePrescription(object selectedItem) { try { Prescription item = selectedItem as Prescription; await imsSvc.DeletePrescriptionAsync(item); var group = AllPrescriptions.Single(grp => grp.TimeStamp == item.Schedule); if (group.Prescriptions.Count > 1) { AllPrescriptions.Single(grp => grp.TimeStamp == item.Schedule).Prescriptions.Remove(item); Prescriptions.Single(grp => grp.TimeStamp == item.Schedule).Prescriptions.Remove(item); } else { AllPrescriptions.Remove(group); Prescriptions.Remove(group); } } catch (Exception e) { MessengerInstance.Send(new ExceptionDialogMessage(e)); } }