public function setRawAttributes(array $attributes = [])
    {
        // We'll filter out those annoying 'count' keys returned with LDAP results,
        // and lowercase all root array keys to prevent any casing issues.
        $this->attributes = array_change_key_case($this->filterRawAttributes($attributes), CASE_LOWER);

        // We'll pull out the distinguished name from our raw attributes
        // and set it into our attributes array with the full attribute
        // definition. This allows us to normalize distinguished
        // names across different LDAP variants.
        if ($dn = Arr::get($attributes, 'dn')) {
            // In some LDAP variants, the distinguished
            // name is returned as an array.
            if (is_array($dn)) {
                $dn = Arr::first($dn);
            }

            $this->setDistinguishedName($dn);
        }

        $this->syncOriginal();

        // Set exists to true since raw attributes are only
        // set in the case of attributes being loaded by
        // query results.
        $this->exists = true;

        return $this;
    }