public function updateRms(bool $create = true, bool $uploadBinary = true,
                              string $path = '/'): FedoraResource {
        $this->created = $this->findResource($create, $uploadBinary, $path);

        // if it has just been created it would be a waste of time to update it
        if (!$this->created) {
            $meta = $this->getMetadata();
            if ($this->metadata) {
                $meta->merge($this->metadata, $this->metadataPreserve);
            }
            $this->fedora->fixMetadataReferences($meta);
            $meta = $this->mergeMetadata($this->res->getMetadata(), $meta);
            $this->res->setMetadata($meta);
            $this->res->updateMetadata();

            $binaryContent = $this->getBinaryData();
            if ($uploadBinary && $binaryContent !== '') {
                $this->res->updateContent($binaryContent, true);
            }
        }

        return $this->res;
    }