public static function hydrate(stdClass $ldap)
    {
        $hydrated = new LdapEntity();

        if (isset($ldap->id)) {
            $hydrated->setId($ldap->id);
        }

        if (isset($ldap->enabled)) {
            $hydrated->setEnabled($ldap->enabled);
        }

        if (isset($ldap->search_dn)) {
            $hydrated->setSearchDn($ldap->search_dn);
        }

        if (isset($ldap->search_password)) {
            $hydrated->setSearchPassword($ldap->search_password);
        }

        if (isset($ldap->search_query)) {
            $hydrated->setSearchQuery($ldap->search_query);
        }

        if (isset($ldap->base_dn)) {
            $hydrated->setBaseDn($ldap->base_dn);
        }

        if (isset($ldap->email_key)) {
            $hydrated->setEmailKey($ldap->email_key);
        }

        if (isset($ldap->user_dn)) {
            $hydrated->setUserDn($ldap->user_dn);
        }

        if (isset($ldap->host)) {
            $hydrated->setHost($ldap->host);
        }

        if (isset($ldap->port)) {
            $hydrated->setPort($ldap->port);
        }

        if (isset($ldap->encryption)) {
            $hydrated->setEncryption($ldap->encryption);
        }

        if (isset($ldap->protocol_version)) {
            $hydrated->setProtocolVersion($ldap->protocol_version);
        }

        if (isset($ldap->expired_accounts)) {
            $hydrated->setExpiredAccounts($ldap->expired_accounts);
        }

        if (isset($ldap->last_sync_at)) {
            $hydrated->setLastSyncAt(new DateTime($ldap->last_sync_at));
        }

        return $hydrated;
    }