class InMemorySecurityMaster extends SimpleAbstractInMemoryMaster<SecurityDocument> implements SecurityMaster {

  @Override
  public SecurityDocument update(final SecurityDocument document) {
    ArgumentChecker.notNull(document, "document");
    ArgumentChecker.notNull(document.getUniqueId(), "document.uniqueId");
    ArgumentChecker.notNull(document.getSecurity(), "document.security");

    final UniqueId uniqueId = document.getUniqueId();
    final Instant now = Instant.now();
    final SecurityDocument storedDocument = _store.get(uniqueId.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Security not found: " + uniqueId);
    }
    document.setVersionFromInstant(now);
    document.setVersionToInstant(null);
    document.setCorrectionFromInstant(now);
    document.setCorrectionToInstant(null);
    if (_store.replace(uniqueId.getObjectId(), storedDocument, document) == false) {
      throw new IllegalArgumentException("Concurrent modification");
    }
    _changeManager.entityChanged(ChangeType.CHANGED, uniqueId.getObjectId(), storedDocument.getVersionFromInstant(), document.getVersionToInstant(), now);
    _externalIdCache.remove(storedDocument.getSecurity());
    _externalIdCache.add(document.getSecurity(), document);
    return document;
  }

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

}