protected function processMediaItem(&$update_sku, array &$data, $download = FALSE) {
    $media_item = $data;

    // Processing is required only for media type image as of now.
    if (isset($data['media_type']) && $data['media_type'] == 'image') {
      if (!empty($data['fid'])) {
        $file = File::load($data['fid']);
        if (!($file instanceof FileInterface)) {
          \Drupal::logger('acm_sku')->error('Empty file object for fid @fid on sku "@sku"', [
            '@fid' => $data['fid'],
            '@sku' => $this->getSku(),
          ]);

          unset($data['fid']);

          // Try to download again if download flag is set to true.
          if ($download) {
            return $this->processMediaItem($update_sku, $data, TRUE);
          }
        }
      }
      elseif ($download) {
        try {
          // Prepare the File object when we access it the first time.
          $file = $this->downloadMediaImage($data);
          $update_sku = TRUE;
        }
        catch (\Exception $e) {
          \Drupal::logger('acm_sku')->error($e->getMessage());
          return NULL;
        }
      }

      if ($file instanceof FileInterface) {
        $data['fid'] = $file->id();
        $media_item['fid'] = $data['fid'];
        $media_item['file'] = $file;
      }

      if (empty($data['label'])) {
        $media_item['label'] = $this->label();
      }

      return $media_item;
    }
  }