public async Task <ActionResult> EditUsers(UsersModificationModel model) { if (model.ReadUsers != null) { var accessRights = model.ReadUsers.Where(accessRight => accessRight.Id != null).ToList(); foreach (var user in accessRights) { await _accessManager.RevokeCreateAccess(user, model.VaultId); await _accessManager.GrantReadAccess(user, model.VaultId); } } if (model.CreateUsers != null) { var accessRights = model.CreateUsers.Where(accessRight => accessRight.Id != null).ToList(); foreach (var user in accessRights) { await _accessManager.RevokeReadAccess(user, model.VaultId); await _accessManager.GrantCreateAccess(user, model.VaultId); } } return(RedirectToAction("EditUsers")); }