private function formatResult(ExecutionResult $executionResult)
    {
        $convertedResult = [
            'data' => $executionResult->data,
        ];
        if (!empty($executionResult->errors)) {
            $convertedResult['errors'] = array_map(function(Error $error) {
                $errorResult = [
                    'message' => $error->message,
                    'locations' => $error->getLocations()
                ];
                $exception = $error->getPrevious();
                if ($exception instanceof FlowException) {
                    $errorResult['message'] = HttpResponse::getStatusMessageByCode($exception->getStatusCode());
                    $errorResult['_exceptionCode'] = $exception->getCode();
                    $errorResult['_statusCode'] = $exception->getStatusCode();
                    $errorResult['_referenceCode'] = $exception->getReferenceCode();
                }
                if ($exception instanceof \Exception) {
                    $this->systemLogger->logException($exception);
                }
                return $errorResult;
            }, $executionResult->errors);
        }
        if (!empty($executionResult->extensions)) {
            $convertedResult['extensions'] = (array)$executionResult->extensions;
        }
        return $convertedResult;
    }