public void LeaveGroup(string index) { try { //Step 1 Code to delete the object from the database SecurityGroupUser user = new SecurityGroupUser(); user.userId = CurrentUser.Text; user.sgId = index; PostRequest <SecurityGroupUser> req = new PostRequest <SecurityGroupUser>(); req.entity = user; PostResponse <SecurityGroupUser> r = _accessControlService.ChildDelete <SecurityGroupUser>(req); if (!r.Success) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r); return; } else { //Step 2 : remove the object from the store UserGroupsStore.Reload(); AllGroupsStore.Reload(); //Step 3 : Showing a notification for the user Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordDeletedSucc }); } } catch (Exception ex) { //In case of error, showing a message box to the user X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show(); } }