protected function findResource(bool $create = true,
                                    bool $uploadBinary = true, string $path = ''): bool {
        $ids    = $this->getIds();
        echo self::$debug ? "searching for " . implode(', ', $ids) . "\n" : "";
        $result = '';

        try {
            $this->res = $this->fedora->getResourceByIds($ids);
            $result    = 'found in cache';
        } catch (NotFound $e) {
            if (!$create) {
                throw $e;
            }

            $meta      = $this->getMetadata();
            $this->fedora->fixMetadataReferences($meta);
            $binary    = $uploadBinary ? $this->getBinaryData() : '';
            $method    = substr($path, -1) == '/' || $path === '' ? 'POST' : 'PUT';
            $this->res = $this->fedora->createResource($meta, $binary, $path, $method);
            $result    = 'not found - created';
        }

        echo self::$debug ? "\t" . $result . " - " . $this->res->getUri(true) . "\n" : "";
        return $result == 'not found - created';
    }