private function getImageUrl($data, $locale)
    {
        // new structures will container an instance of MediaSelectionContainer
        if ($data instanceof MediaSelectionContainer) {
            $medias = $data->getData('de');
        // old ones an array ...
        } else {
            if (!isset($data['ids'])) {
                throw new \RuntimeException(
                    sprintf('Was expecting media value to contain array key "ids", got: "%s"', print_r($data, true))
                );
            }

            $medias = $this->mediaManager->get($locale, [
                'ids' => $data['ids'],
            ]);
        }

        // no media, no thumbnail URL
        if (!$medias) {
            return;
        }

        $media = current($medias);

        if (!$media) {
            return;
        }

        $formats = $media->getThumbnails();

        if (!isset($formats[$this->searchImageFormat])) {
            throw new \InvalidArgumentException(
                sprintf('Search image format "%s" is not known', $this->searchImageFormat)
            );
        }

        return $formats[$this->searchImageFormat];
    }