public ActionResult SaveManagementRole(string currOrg, string roleManagement) { ChangeRecords <ManagementRoleDTO> records = new StoreDataHandler(roleManagement).BatchObjectData <ManagementRoleDTO>(); var curOrganization = _service.GetOrgById(currOrg); foreach (var updatedRec in records.Updated) { if (updatedRec.Granted.ToLower() == "true") { SA_ManagementRole role = new SA_ManagementRole { OrgId = curOrganization.Id, OrgName = curOrganization.Name, OrgIdPath = curOrganization.IdPath, OrgNamePath = curOrganization.NamePath, RoleId = ConvertToInt(updatedRec.Id), RoleType = updatedRec.RoleType, CreatedBy = GetCurrentUserName(), CreatedDate = DateTime.Now, CreatedByIdPath = GetOrganizationIdPath(), CreatedByNamePath = GetOrganizationNamePath() }; _service.AddManagementRole(role); } else { _service.DeleteManagementRole(updatedRec.ManagementId); } } _service.Save(); return(this.Direct()); }