code: private function persistInvoice(Invoice\InvoiceInterface $invoice)
      {
          $this->persistenceHelper->persistAndRecompute($invoice, true);
  
          foreach ($invoice->getLines() as $line) {
              $this->persistenceHelper->persistAndRecompute($line, true);
          }
  
          // Persist the shipment <-> invoice relation, without scheduling event.
          $this->persistenceHelper->persistAndRecompute($invoice->getShipment(), false);
      }
docs: Persists the invoice.
  
  @param Invoice\InvoiceInterface $invoice