// GET: DominoesGroups/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            DominoesGroup dominoesGroup = db.DominoesGroup.Find(id);
            var model = new UserViewModel();
            var AllUsers = db.UserProfileInfo.Select(
                u => new
                {
                    UserID = u.UserProfileInfoID,
                    Name = u.FirstName
                }).ToList();

            model.DominoesGroupID = id.Value;
            model.UsersSelect = new MultiSelectList (AllUsers, "UserID", "Name");
            model.UserIDs = dominoesGroup.Users.Select(u => u.UserProfileInfoID).ToArray();

            if (dominoesGroup == null)
            {
                return HttpNotFound();
            }
            return View(model);
        }
        public ActionResult Edit(UserViewModel UserViewModel)
        {
            var dominoesGroup = db.DominoesGroup
                          .Include(i => i.Users)
                          .Where(i => i.DominoesGroupID == UserViewModel.DominoesGroupID)
                          .Single();

            if (ModelState.IsValid)
            {
                db.Entry(dominoesGroup).State = EntityState.Modified;
                UpdateGroupUsers(UserViewModel.UserIDs, dominoesGroup);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(UserViewModel.UserIDs);
        }