Retrieving collections from a database
Two comments -


Entity Framework already does what you do in the first loop. If you load entities into a context, for example by querying them, EF populates navigation properties by a process called relationship fixup.

So if you do ...

var announcements = _context.JobAnnouncements
    .Include(a =&gt; a.Portal)
    .Where(a =&gt; a.To.Day &gt;= DateTime.Now.Day)
    .Where(a =&gt; a.IsDeleted == false)
    .ToList();

var positions = _context.JobAnnouncementPositions
    .Include(a =&gt; a.Team)
    .Include(a =&gt; a.Level)
    .Include(a =&gt; a.Technology)
    .Include(a =&gt; a.DocumentsInfo.Select(d =&gt; d.Document))
    .Where(p =&gt; p.IsDeleted == false)
    .ToList();


... You'll notice that both JobAnnouncement.JobAnnouncementPosition and JobAnnouncementPosition.JobAnnouncements are populated as far as their entities are available.
The second loop isn't necessary. You can return positions. It won't contain null objects.


That would leave you with the two queries and a return statement.

But there's more.

As you say, if you use Include, you get all data, including deleted items. It's because of this annoying inability of EF to filter Includes why such elaborate workarounds are necessary. But there is a third-party library that makes this a lot easier: EntityFramework.DynamicFilters.

This library offers a simple API to define global filters that can be switched on and off. In you case it could look like:

modelBuilder.Filter("ActiveJobAnnouncements",
                        (JobAnnouncement a) =&gt; !a.IsDeleted);
modelBuilder.Filter("ActiveJobAnnouncementPositions",
                        (JobAnnouncementPositions p) =&gt; !p.IsDeleted);


Having these filters added to the model builder in OnModelCreating, you'll see that whenever you query any of these entities, the filter !IsDeleted will be part of the SQL query. Also when using Includes. If you want deleted items as well, just disable the filters in a context instance:

context.DisableFilter("ActiveJobAnnouncements");
context.DisableFilter("ActiveJobAnnouncementPositions");


I think this library is a gem.

One more thing: I my opinion, repositories, if you decide to use them, should be generic repositories. That means, for each entity class they do exactly the same thing. Your GetForListActive() method doesn't belong in a repository, rather in a service (that uses repositories).