This fixes incorrect data retrieval when all entities (including those whose time does not correspond to the desired period) have been loaded from the database
refactor: move methods to their proper classes