How to structure query functions in services

I have the following function in my service layer csharp:

PS: A category can have List<Item>
public async Task<List<Category>> GetCategories()
{
    await using var db = await contextFactory.CreateDbContextAsync();
    return await db.Categories
        .AsNoTracking()
        .OrderBy(c => c.Sort)
        .ToListAsync();
}

Sometimes I need GetCategories() to just be the Category without any navigation properties included.
But also sometimes I need GetCategories() to also include the Items navigation property...

I'm thinking of having two functions with two separate dtos (one has only the category, the other one has the category + the items).

But I was wondering if there's a better way to do this
Was this page helpful?