protected function getAttributesToLdap(array $attributes, $translate, LdapObjectSchema $schema = null, $alias = null)
    {
        // First determine if this was some sort of wildcard selection
        $attributes = $this->getSelectedQueryAttributes($attributes, $schema);
        // This will return only the attributes for the current alias, minus the possible alias prefix.
        if ($schema) {
            $attributes = $this->getAttributesForAlias($attributes, $alias);
        }
        // If we still have an empty array here, then fill it with the defaults because nothing was selected specifically.
        if ($schema && empty($attributes)) {
            $attributes = $schema->getAttributesToSelect();
        }
        // At this point we add any orderBy attributes that are not being specifically selected already.
        if (!empty($this->orderBy)) {
            $attributes = $this->mergeOrderByAttributes($attributes, $alias);
        }
        
        if ($schema && $translate) {
            $newAttributes = [];
            foreach ($attributes as $attribute) {
                $newAttributes[] = $schema->getAttributeToLdap($attribute);
            }
            $attributes = $newAttributes;
        }

        return $attributes;
    }