public IEnumerable <CategoryViewModel> GetCategoryTree() { var categories = _storageDb.QueryCategories() .DeepMap <CategoryViewModel[]>() .OrderBy(x => x.ParentId) .ThenBy(x => x.Order) .ToArray(); var tree = GenerateCategoryTree(categories); return(tree); }