protected function setDnToUse(AddOperation $operation)
    {
        // If the DN was explicitly set, don't do anything.
        if ($operation->getDn()) {
            return;
        }
        if (!$this->schema) {
            throw new LogicException("You must explicitly set the DN or specify a schema type.");
        }
        $location = $operation->getLocation() ?: $this->schema->getDefaultContainer();
        if (empty($location)) {
            throw new LogicException('You must specify a container or OU to place this LDAP object in.');
        }
        // Handles a possible multi-valued RDN, where each RDN is pieced together with a '+'
        $rdn = implode('+', array_map(function($rdn) use ($operation) {
            return $rdn.'='.LdapUtilities::escapeValue($operation->getAttributes()[$rdn], null, LDAP_ESCAPE_DN);
        }, $this->getRdnFromAttributes(array_keys($operation->getAttributes()))));
        $operation->setDn($rdn.','.$this->resolveParameters(['container' => $location])['container']);
    }