code: public function onInsert(ResourceEventInterface $event)
      {
          $stockAdjustment = $this->getStockAdjustmentFromEvent($event);
  
          if (null === $stockUnit = $stockAdjustment->getStockUnit()) {
              throw new RuntimeException("Stock unit must be set at this point.");
          }
  
          $quantity = StockAdjustmentReasons::isDebitReason($stockAdjustment->getReason())
              ? -$stockAdjustment->getQuantity()
              : $stockAdjustment->getQuantity();
  
          $this->stockUnitUpdater->updateAdjusted($stockUnit, $quantity, true);
      }
docs: Insert event handler.
  
  @param ResourceEventInterface $event