private function getFileVersionForMedia(MediaInterface $media)
    {
        /** @var File $file */
        $file = $media->getFiles()->get(0);
        if (!isset($file)) {
            throw new FileVersionNotFoundException($media->getId(), 'latest');
        }

        $fileVersion = $file->getLatestFileVersion();
        if (!isset($fileVersion)) {
            throw new FileVersionNotFoundException($media->getId(), 'latest');
        }

        return $fileVersion;
    }