private function getResponse($code = 500, $headers = [], $body = null)
    {
        if (isset($body) && is_array($body)) {
            if (!isset($body['error'])) {
                $body = ['error' => $body];
            }
            $body = json_encode($body);
            $headers['Content-type'] = 'application/json';
        }
        return new Response($code, $headers, $body);
    }