class LdapAdapter implements TokenStorageAdapter<Connection> {

    public boolean update(Connection connection, Token previous, Token updated) throws LdapOperationFailedException {
        Entry currentEntry = conversion.getEntry(updated);
        LdapTokenAttributeConversion.stripObjectClass(currentEntry);

        Entry previousEntry = conversion.getEntry(previous);
        LdapTokenAttributeConversion.stripObjectClass(previousEntry);

        ModifyRequest request = Entries.diffEntries(previousEntry, currentEntry,
            Entries.diffOptions().replaceSingleValuedAttributes());

        request.addControl(TransactionIdControl.newControl(AuditRequestContext.createSubTransactionIdValue()));

        // Test to see if there are any modifications
        if (request.getModifications().isEmpty()) {
            return false;
        }

        try {
            processResult(connection.modify(request));
        } catch (LdapException e) {
            throw new LdapOperationFailedException(e.getResult());
        }
        return true;
    }

    @Inject public  LdapAdapter(LdapTokenAttributeConversion conversion, LdapQueryFilterVisitor queryConverter,
            LdapQueryFactory queryFactory);

}