public ActionResult AddOperation(Operations model) { if (ModelState.IsValid) { Operation NewOperation = gm.AddOperation(model.Id, model.OperationId); List <User> Users = gm.FindGroup(model.Id).Users.ToList(); UserManager um = new UserManager(new DBContext()); foreach (User user in Users) { if (!user.Operations.Contains(NewOperation)) { um.AddOperation(user.Id, model.OperationId); } } return(RedirectToAction("Details", new { Id = model.Id })); } return(View(model)); }