protected void btnRemove_Click(object sender, DirectEventArgs e) { try { string json = e.ExtraParams["removeItem"]; List <SystemApplicationWrapper> companies = JSON.Deserialize <List <SystemApplicationWrapper> >(json); List <int> assignedAppIDs = new List <int>(); foreach (SystemApplicationWrapper systemApplicationWrapper in companies) { assignedAppIDs.Add(systemApplicationWrapper.SystemApplicationID); } SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(RoleID); SystemRoleWrapper.PatchRemoveRoleApplications(systemRoleWrapper, assignedAppIDs); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message); } }