docs: protected PaginatedList<DTO> findPaginatedWithQueryFilterAndSort(DBQuery.Query query,
                                                                       Predicate<DTO> filter,
                                                                       DBSort.SortBuilder sort,
                                                                       int page,
                                                                       int perPage) {
          final AtomicInteger total = new AtomicInteger(0);
  
          try (final Stream<DTO> cursor = streamQueryWithSort(query, sort)) {
              // First created a filtered stream
              final Stream<DTO> dtoStream = cursor
                      .filter(filter)
                      .peek(dto -> total.incrementAndGet());
  
              // Then use that filtered stream and only collect the entries according to page and perPage
              final List<DTO> list = Stream.of(dtoStream)
                      .flatMap(stream -> stream)
                      .skip(perPage * Math.max(0, page - 1))
                      .limit(perPage)
                      .collect(Collectors.toList());
  
              return new PaginatedList<>(list, total.get(), page, perPage);
          }
      }