// GET: Groups
        public ActionResult List()
        {
            GroupsService groupService = new GroupsService();
            GroupListVM   model        = new GroupListVM();

            TryUpdateModel(model);

            //model.Groups = groupService.GetAll();
            model.Groups = new Dictionary <Group, IEnumerable <SelectListItem> >();
            foreach (var group in groupService.GetAll())
            {
                IEnumerable <SelectListItem> contacts = groupService.GetContactsByGroup(group);
                model.Groups.Add(group, contacts);
            }

            if (model.Search != null)
            {
                model.Groups = model.Groups.Where(g => g.Key.Name.Contains(model.Search)).ToDictionary(v => v.Key, v => v.Value);
            }

            switch (model.SortOrder)
            {
            case "name_desc": model.Groups = model.Groups.OrderByDescending(g => g.Key.Name).ToDictionary(v => v.Key, v => v.Value); break;

            case "name_asc":
            default:
                model.Groups = model.Groups.OrderBy(g => g.Key.Name).ToDictionary(v => v.Key, v => v.Value);
                break;
            }

            return(View(model));
        }