code: public function transform()
      {
          if (null === $this->source || null === $this->target) {
              throw new LogicException("Please call initialize first.");
          }
  
          $event = new SaleTransformEvent($this->source, $this->target);
  
          $this->eventDispatcher->dispatch(SaleTransformEvents::PRE_TRANSFORM, $event);
          if ($event->hasErrors() || $event->isPropagationStopped()) {
              return $event;
          }
  
          // Persist the target sale
          $targetEvent = $this->getOperator($this->target)->persist($this->target);
          if (!$targetEvent->isPropagationStopped() && !$targetEvent->hasErrors()) {
              // Disable the uploadable listener
              $this->uploadableListener->setEnabled(false);
  
              // Delete the source sale
              $sourceEvent = $this->getOperator($this->source)->delete($this->source, true); // Hard delete
              if (!$sourceEvent->isPropagationStopped() && !$sourceEvent->hasErrors()) {
                  $targetEvent = null;
              }
  
              // Enable the uploadable listener
              $this->uploadableListener->setEnabled(true);
          }
  
          $this->eventDispatcher->dispatch(SaleTransformEvents::POST_TRANSFORM, $event);
          if ($event->hasErrors() || $event->isPropagationStopped()) {
              return $event;
          }
  
          // Unset source and target sales
          $this->source = null;
          $this->target = null;
  
          return $targetEvent;
      }
docs: Transforms the given source sale to the given target sale.
  
  @return \Ekyna\Component\Resource\Event\ResourceEventInterface|null The event that stopped transformation if any.
  
  @throws LogicException If initialize has not been called first.