transactions->run(function () use ($exportId, $change): void { $export = $this->exports->findById($exportId, lock: true) ?? throw new BillingExportNotFound($exportId); $export->ensureDraft(); $change($export); $this->exports->save($export); }); } }