public async Task<ActionResult> UserRoles(SelectUserRolesViewModel model)
 {
     if (ModelState.IsValid)
     {
         var user = await UserManager.FindByIdAsync(model.UserId);
         foreach (var role in model.Roles)
         {
             bool iNoEdit = User.IsInRole("Manager") && role.RoleName == "Administrator" ? true : false;
             bool iEdit = await UserManager.IsInRoleAsync(user.Id, role.RoleName);
             if (!role.Selected && !iNoEdit)
             {
                 if (iEdit) await UserManager.RemoveFromRoleAsync(user.Id, role.RoleName);
             }
             else
             {
                 if (!iEdit && !iNoEdit) await UserManager.AddToRoleAsync(user.Id, role.RoleName);
             }
         }
         return RedirectToAction("index");
     }
     return View();
 }        
 public ActionResult UserRoles(string id)
 {
     var user = db.Users.First(u => u.Id == id);
     var model = new SelectUserRolesViewModel(user, db);
     model.UserId = id;
     return View(model);
 }