public ActionResult AddMember(AddMemberView view)
        {
            if (!ModelState.IsValid)
            {

                ViewBag.UserId = new SelectList(db.Users.
                                            OrderBy(u => u.FirstName).
                                            ThenBy(u => u.LastName), "UserId", "FullName");
                return View(view);
            }

            var member = db.GroupMembers.Where(gm => gm.GroupId == view.GroupId && gm.UserId == view.UserId).FirstOrDefault();

            if (member != null)
            {
                ViewBag.UserId = new SelectList(db.Users.
                                            OrderBy(u => u.FirstName).
                                            ThenBy(u => u.LastName), "UserId", "FullName");
                ViewBag.Error = "The member already belongs to group.";

                return View(view);
            }

            member = new GroupMember
            { 
                GroupId = view.GroupId,
                UserId = view.UserId
            };

            db.GroupMembers.Add(member);
            db.SaveChanges();

            return RedirectToAction(string.Format("Details/{0}", view.GroupId));
        }
        public ActionResult AddMember(int groupId)
        {

            ViewBag.UserId = new SelectList(db.Users.
                                            OrderBy(u=>u.FirstName).
                                            ThenBy(u=>u.LastName), "UserId", "FullName");
            var view = new AddMemberView
            {
                GroupId = groupId
            };

            return View(view);
        }