code: protected function getProductPhoto(MediaInterface $media, ProductInterface $modelData, $values)
      {
          $mainPhoto    = $this->isMainPhoto($media, $values['main']);
          $productPhoto = new ProductPhoto();
          $productPhoto->setPhoto($media);
          $productPhoto->setMainPhoto($mainPhoto);
          $productPhoto->setProduct($modelData);
          
          if ($mainPhoto) {
              $modelData->setPhoto($media);
          }
          
          return $productPhoto;
      }
docs: Returns product photo model
  
  @param MediaInterface   $media
  @param ProductInterface $modelData
  @param array            $values
  
  @return ProductPhoto