private function checkMetadataPrefix($metadataPrefix, $identifier = null)
    {
        $availableMetadataFormats = $this->repository->listMetadataFormats($identifier);

        $found = false;
        if (!empty($availableMetadataFormats)) {
            foreach ($availableMetadataFormats as $metadataFormat) {
                if ($metadataPrefix == $metadataFormat->getPrefix()) {
                    $found = true;
                    break;
                }
            }
        }

        if (!$found) {
            throw new CannotDisseminateFormatException(
                'The metadata format identified by the value given for the metadataPrefix argument '
                . 'is not supported by the item or by the repository.'
            );
        }
    }