code: protected function initializeProductMediaGalleryValueToEntity(array $attr)
      {
  
          // load the row/value ID
          $rowId = $attr[MemberNames::ROW_ID];
          $valueId = $attr[MemberNames::VALUE_ID];
  
          // query whether the product media gallery value to entity entity already exists or not
          if ($this->loadProductMediaGalleryValueToEntityByValueIdAndRowId($valueId, $rowId)) {
              return;
          }
  
          // simply return the attributes
          return $attr;
      }
docs: Initialize the product media gallery value to entity with the passed attributes and returns an instance.
  
  @param array $attr The product media gallery value to entity attributes
  
  @return array|null The initialized product media gallery value to entity, or NULL if the product media gallery value to entity already exists