code: public static function convert(ContentItemInterface $from, ContentItemInterface $to)
      {
          $reflectionFrom = new \ReflectionClass($from);
          $reflectionTo = new \ReflectionClass($to);
  
          foreach ($reflectionFrom->getProperties() as $property) {
              $property->setAccessible(true);
              $method = 'set' . ucfirst($property->getName());
              if ($reflectionTo->hasMethod($method)) {
                  $to->$method($property->getValue($from));
              }
          }
  
          return $to;
      }
docs: Copies all properties from the source to the target, if the target has the specified properties.
  
  @param ContentItemInterface $from
  @param ContentItemInterface $to
  @return ContentItemInterface