public function storeVariables(
        QtiRunnerServiceContext $context,
        $itemUri,
        $metaVariables,
        $itemId = null
    ) {
        $sessionId = $context->getTestSession()->getSessionId();

        /** @var DeliveryServerService $deliveryServerService */
        $deliveryServerService = $this->getServiceManager()->get(DeliveryServerService::SERVICE_ID);
        $resultStore = $deliveryServerService->getResultStoreWrapper($sessionId);

        $testUri = $context->getTestDefinitionUri();

        if (!is_null($itemUri)) {
            $resultStore->storeItemVariables($testUri, $itemUri, $metaVariables, $this->getTransmissionId($context, $itemId));
        } else {
            $resultStore->storeTestVariables($testUri, $metaVariables, $sessionId);
        }

        return true;
    }