class InMemoryConfigMaster implements ConfigMaster {

  @Override
  public ConfigDocument update(final ConfigDocument document) {
    ArgumentChecker.notNull(document, "document");
    ArgumentChecker.notNull(document.getUniqueId(), "document.uniqueId");
    ArgumentChecker.notNull(document.getConfig(), "document.object");
    ArgumentChecker.notNull(document.getConfig().getValue(), "document.object.value");

    UniqueId uniqueId = document.getUniqueId();
    final Instant now = Instant.now();
    final ConfigDocument storedDocument = _store.get(uniqueId.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Config not found: " + uniqueId);
    }
    document.setVersionFromInstant(now);
    document.setVersionToInstant(null);
    document.setCorrectionFromInstant(now);
    document.setCorrectionToInstant(null);
    uniqueId = uniqueId.withVersion(Long.toString(_versions.incrementAndGet()));
    document.setUniqueId(uniqueId);
    IdUtils.setInto(document.getConfig().getValue(), uniqueId);
    if (_store.replace(uniqueId.getObjectId(), storedDocument, document) == false) {
      throw new IllegalArgumentException("Concurrent modification");
    }
    _changeManager.entityChanged(ChangeType.CHANGED, document.getObjectId(), document.getVersionFromInstant(), document.getVersionToInstant(), now);
    return document;
  }

  public  InMemoryConfigMaster();
  public  InMemoryConfigMaster(final ChangeManager changeManager);
  public  InMemoryConfigMaster(final Supplier<ObjectId> objectIdSupplier);
  public  InMemoryConfigMaster(final Supplier<ObjectId> objectIdSupplier, final ChangeManager changeManager);

}