private bool AddEditUserGroupsDialog_OKClicked(UserGroupRowData userGroup) { if (AddEditUserGroupsDialog.EditMode) { // Commit the change into database if (_controller.UpdateUserGroup(userGroup)) { UserGroupsPanel.UpdateUI(); return(true); } return(false); } else { try { if (_controller.AddUserGroup(userGroup)) { UserGroupsPanel.UpdateUI(); return(true); } return(false); } catch (Exception) { return(false); } } }