class OfferLogDatabaseService {

    public void save(String containerName, String fileName, OfferLogAction action, long sequence)
        throws ContentAddressableStorageServerException, ContentAddressableStorageDatabaseException {
        try {
            OfferLog offerLog = new OfferLog(sequence, LocalDateUtil.now(), containerName, fileName, action);
            mongoCollection.insertOne(Document.parse(JsonHandler.writeAsString(offerLog)));
        } catch (MongoException e) {
            throw new ContentAddressableStorageDatabaseException(String.format(
                "Database Error while saving %s in OfferLog collection", fileName), e);
        } catch (InvalidParseOperationException e) {
            throw new ContentAddressableStorageServerException("Cannot parse storage log", e);
        }
    }

    public  OfferLogDatabaseService(MongoCollection<Document> mongoCollection);

}