public function incrementalFetch($uSNChangedFrom, $uSNChangedTo, $detectDeleted = false)
    {
        // fetch changed
        $changedFilter = Filter::andFilter(
            Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom),
            Filter::lessOrEqual('uSNChanged', $uSNChangedTo)
        );
        if ($this->incrementalSyncEntryFilter) {
            $changedFilter = $changedFilter->addAnd($this->incrementalSyncEntryFilter);
        }
        $changed = $this->search($changedFilter);

        // fetch deleted
        $deleted = [];
        if ($detectDeleted) {
            $defaultNamingContext = $this->getRootDse()->getDefaultNamingContext();
            $options              = $this->ldap->getOptions();
            $originalHost         = isset($options['host']) ? $options['host'] : '';
            $hostForDeleted = rtrim($originalHost, "/") . "/" .urlencode(
                    sprintf("<WKGUID=%s,%s>", self::WK_GUID_DELETED_OBJECTS_CONTAINER_W, $defaultNamingContext)
                )
            ;

            // hack that workarounds zendframework/zend-ldap connection issues.
            // should be removed after resolution of https://github.com/zendframework/zend-ldap/pull/69
            if (!preg_match('~^ldap(?:i|s)?://~', $hostForDeleted)) {
                $schema = "ldap://";
                if ((isset($options['port']) && $options['port'] == 636) || (isset($options['useSsl']) && $options['useSsl'] == true)) {
                    $schema = "ldaps://";
                }
                $hostForDeleted = $schema.$hostForDeleted;
            }
            // end of hack

            $options['host'] = $hostForDeleted;

            // force reconnection for search of deleted entries
            $this->ldap->setOptions($options);
            $this->ldap->disconnect();

            $deletedFilter = Filter::andFilter(
                Filter::equals('isDeleted', 'TRUE'),
                Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom),
                Filter::lessOrEqual('uSNChanged', $uSNChangedTo)
            );
            if ($this->deletedSyncEntryFilter) {
                $deletedFilter = $deletedFilter->addAnd($this->deletedSyncEntryFilter);
            }
            $deleted = $this->search($deletedFilter);
        }

        return [$changed, $deleted];
    }