class OfferLogDatabaseService {

    public void bulkSave(String containerName, List<String> fileNames, OfferLogAction action, long sequence)
        throws ContentAddressableStorageServerException, ContentAddressableStorageDatabaseException {
        try {
            List<Document> documents = new ArrayList<>();
            for (String fileName : fileNames) {
                OfferLog offerLog = new OfferLog(sequence, LocalDateUtil.now(), containerName, fileName, action);
                documents.add(Document.parse(JsonHandler.writeAsString(offerLog)));
                sequence++;
            }
            mongoCollection.insertMany(documents, new InsertManyOptions().ordered(false));
        } catch (MongoException e) {
            throw new ContentAddressableStorageDatabaseException(String.format(
                "Database Error while saving %s in OfferLog collection", fileNames), e);
        } catch (InvalidParseOperationException exc) {
            throw new ContentAddressableStorageServerException("Cannot parse storage log", exc);
        }
    }

    public  OfferLogDatabaseService(MongoCollection<Document> mongoCollection);

}