public ActionResult ManageProjectUsers(List <int> projects, string ProjectManagerId, List <string> developers, List <string> submitters) { //Remove users from selected projects if (projects != null) { foreach (var projectId in projects) { foreach (var user in helperRoles.UsersOnProject(projectId).ToList()) { helperRoles.RemoveUserFromProject(user.Id, projectId); } if (!string.IsNullOrEmpty(ProjectManagerId)) { helperRoles.AddUserToProject(ProjectManagerId, projectId); } if (developers != null) { foreach (var developerId in developers) { helperRoles.AddUserToProject(developerId, projectId); } } if (submitters != null) { foreach (var submittedId in submitters) { helperRoles.AddUserToProject(submittedId, projectId); } } } } return(RedirectToAction("ManageProjectUsers")); }