public static void createLdapEntries(final LDAPConnection connection, final Collection<LdapEntry> entries,
                                         final BindConnectionInitializer connInit) {
        for (val entry : entries) {
            val attrs = new ArrayList<Attribute>(entry.getAttributeNames().length);
            attrs.addAll(entry.getAttributes().stream()
                .map(a -> new Attribute(a.getName(), a.getStringValues())).toList());

            val ad = new AddRequest(entry.getDn(), attrs);
            LOGGER.debug("Creating entry [{}] with attributes [{}]", entry, attrs);
            try {
                val result = connection.add(ad);
                LOGGER.debug("Added entry [{}]: result code [{}] on matched DN [{}]",
                    entry, result.getResultString(), result.getMatchedDN());
            } catch (final LDAPException e) {
                LOGGER.debug(e.getMessage(), e);
                if (e.getResultCode().equals(ResultCode.ENTRY_ALREADY_EXISTS)) {
                    modifyLdapEntries(connection, entries, connInit);
                } else {
                    LoggingUtils.error(LOGGER, e);
                }
            } catch (final Exception e) {
                LoggingUtils.error(LOGGER, e);
            }
        }
    }
Creates the given LDAP entries.

@param connection Open LDAP connection used to connect to directory.
@param entries    Collection of LDAP entries.
@param connInit   the connection initializer
support/cas-server-support-ldap-core/src/test/java/org/apereo/cas/util/LdapTestUtils.java