private static IEnumerable<CategoryDto> GetChildren(string parentId, CategoryDataRow[] categoryRows) { return categoryRows .Where(c => c.ParentId == parentId) .Select(c => new CategoryDto(c.Id, c.Title, GetChildren(c.Id, categoryRows).ToArray())); }