private function getMedia(Document $document, $field)
    {
        $images = json_decode($document->getField($field)->getValue(), true);

        if (!array_key_exists('ids', $images) || 0 === count($images['ids'])) {
            return;
        }

        return $images['ids'][0];
    }