public async void ConfirmSave() { if (Model == null) { return; } try { if (IsNew) { // Save new entity var createdOrder = await _orderServiceAgent.CreateOrder(Model); Model = createdOrder; } else { // Get changes, exit if none var changedOrder = ChangeTracker.GetChanges().SingleOrDefault(); if (changedOrder == null) { return; } // We're not changing customer if (changedOrder.Customer != null) { changedOrder.Customer = null; } // Save changes var updatedOrder = await _orderServiceAgent.UpdateOrder(changedOrder); ChangeTracker.MergeChanges(updatedOrder); // Unsubscribe to collection changed on order details Model.OrderDetails.CollectionChanged -= OnOrderDetailsChanged; // End editing EndEdit(); } // Notify view of confirmation Notify(ResultNotice, new NotificationEventArgs <bool>(null, true)); } catch (Exception ex) { NotifyError(null, ex); } }