protected function getSelectedQueryAttributes(array $attributes, LdapObjectSchema $schema = null)
    {
        // Interpret a single wildcard as only schema attributes.
        if ($schema && !empty($attributes) && $attributes[0] == '*') {
            $attributes = array_keys($schema->getAttributeMap());
        // Interpret a double wildcard as all LDAP attributes even if they aren't in the schema file.
        } elseif ($schema && !empty($attributes) && $attributes[0] == '**') {
            $attributes = ['*'];
        }

        return $attributes;
    }