class VitamMongoRepository implements VitamRepository {

    @Override
    public VitamRepositoryStatus saveOrUpdate(Document document) throws DatabaseException {
        ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED, collection, document);
        try {
            ReplaceOneModel<Document> replaceOneModel =
                new ReplaceOneModel<>(eq("_id", document.get("_id")), document,
                    new UpdateOptions().upsert(true));
            UpdateResult result = collection.replaceOne(replaceOneModel.getFilter(), replaceOneModel.getReplacement(),
                replaceOneModel.getOptions());
            if (result.getModifiedCount() > 0) {
                return VitamRepositoryStatus.UPDATED;
            } else {
                return VitamRepositoryStatus.CREATED;
            }
        } catch (Exception e) {
            LOGGER.error("Insert or Update Document Exception: ", e);
            throw new DatabaseException(e);
        }
    }

    public  VitamMongoRepository(MongoCollection<Document> collection);

}