public ActionResult Index(string filter = null)
 {
     var list = new List<GroupViewModel>();
     foreach (var result in query.Query(groupSvc.DefaultTenant, filter))
     {
         var item = groupSvc.Get(result.ID);
         var kids = new List<GroupViewModel>();
         foreach (var child in item.Children)
         {
             var childGrp = groupSvc.Get(child.ChildGroupID);
             kids.Add(new GroupViewModel { ID = child.ChildGroupID, Name = childGrp.Name });
         }
         var descendants = groupSvc.GetDescendants(item).Select(x => x.Name).ToArray();
         var gvm = new GroupViewModel
         {
             ID = item.ID,
             Name = item.Name,
             Children = kids,
             Descendants = descendants
         };
         list.Add(gvm);
     }
     var vm = new GroupIndexViewModel { 
         Groups = list
     };
     return View("Index", vm);
 }
 public ActionResult Index()
 {
     var list = new List<GroupViewModel>();
     foreach(var item in groupSvc.GetAll())
     {
         var kids = new List<GroupViewModel>();
         foreach (var child in item.Children)
         {
             var childGrp = groupSvc.Get(child.ChildGroupID);
             kids.Add(new GroupViewModel { ID = child.ChildGroupID, Name = childGrp.Name });
         }
         var descendants = groupSvc.GetDescendants(item).Select(x=>x.Name).ToArray();
         var gvm = new GroupViewModel
         {
             ID = item.ID, Name = item.Name,
             Children = kids, 
             Descendants = descendants
         };
         list.Add(gvm);
     }
     var vm = new GroupIndexViewModel { 
         Groups = list
     };
     return View("Index", vm);
 }