public IEnumerable <StructuralGroupViewModel> GetLeaves() { using (var structureRepository = new StructureRepository(ApplicationContext.DatabaseContext.Database, ApplicationContext.Services.MemberService)) { var root = structureRepository.GetRootForMember(Members.GetCurrentMember()); var leaves = new List <StructuralGroup>(); structureRepository.PopulateLeaves(root, leaves); var viewModels = leaves.Select(StructuralGroupViewModel.FromModel); return(viewModels); } }