protected function sendResponse($response, $http_code = 200)
    {
        $http_code = min(max($http_code, 100), 505);
        http_response_code($http_code);
        header('Content-type: application/json');
        echo json_encode($response);
    }