/**
  * @param Media $media
  *
  * @throws \RuntimeException when the file does not exist
  */
 public function prepareMedia(Media $media)
 {
     if (null == $media->getUuid()) {
         $uuid = uniqid();
         $media->setUuid($uuid);
     }
     $slide = new RemoteSlideHelper($media);
     $code = $slide->getCode();
     // update thumbnail
     switch ($slide->getType()) {
         case 'slideshare':
             try {
                 $json = json_decode(file_get_contents('http://www.slideshare.net/api/oembed/2?url=http://www.slideshare.net/slideshow/embed_code/' . $code . '&format=json'));
                 $slide->setThumbnailUrl($json->thumbnail);
             } catch (\ErrorException $e) {
                 // Silent exception - should not bubble up since failure to create a thumbnail is not a fatal error
             }
             break;
     }
 }