class OfferLogCompactionDatabaseService {

    public CloseableIterable<CompactedOfferLog> getDescendingOfferLogCompactionBy(String containerName, Long offset) {
        Bson searchFilterCompaction = offset != null
            ? and(eq(CONTAINER, containerName), lte(SEQUENCE_END, offset))
            : eq(CONTAINER, containerName);

        Bson sequenceSort = Sorts.orderBy(Sorts.descending(SEQUENCE_END));
        return toCloseableIterable(
            offerLogCompactionCollection.find(searchFilterCompaction)
                .sort(sequenceSort)
                .map(this::transformDocumentToOfferLogCompaction)
        );
    }

    public  OfferLogCompactionDatabaseService(MongoCollection<Document> offerLogCompactionCollection);

}