public function getResponse()
    {
        $response = new Response();

        $message = new Message();
        $message->setData(['message' => $this->getMessage()]);

        if (!empty($this->getPrivateKey())) {
            $message->setCertificate($this->getCertificate());
            $message->sign($this->getPrivateKey());
        }

        $response->getBody()->write(json_encode($message));

        return $response
            ->withStatus($this->getCode())
            ->withAddedHeader('Content-Type', 'application/json');
    }