private async void Save() { SetValues(); if (!IsValid(User)) return; using (var c = NestedContainer) { _proxy = Using<IDistributorServiceProxy>(c); ResponseBool response = null; if (SelectedUserType == UserType.None) { MessageBox.Show(GetLocalText("sl.user.edit.validate.usertype") /*"Select user type"*/, "Distributr: Invalid Field(s)", MessageBoxButton.OK); return; } if (User.UserType == UserType.PurchasingClerk) { response = await SavePurchasingClerkCostCentre(); if (!response.Success) return; } else { var userItem = CreateUserItem(GetConfigParams().CostCentreId); response = await _proxy.UserAddAsync(userItem); AuditLogEntry = string.Format("Created New User: {0}; Code: {1}; And User Type", userItem.Username, SelectedUserType); Using<IAuditLogWFManager>(c).AuditLogEntry("User Administration", AuditLogEntry); MessageBox.Show(response.ErrorInfo, "Agrimanagr: Manage Users", MessageBoxButton.OK, MessageBoxImage.Information); } if (response.Success) { if (await SaveContacts(User)) { ConfirmNavigatingAway = false; SendNavigationRequestMessage(new Uri(@"\views\admin\users\listusers.xaml", UriKind.Relative)); } } } }