private function createResponseObject(callable $callable)
    {
        try {
            $response = new JsonResponse($callable());
        } catch (EntityNotFoundException $notFoundException) {
            $response = new JsonResponse(
                $notFoundException->getMessage(),
                404
            );
        } catch (Exception $e) {
            $response = new JsonResponse(
                'API exception. Please contact your webmaster',
                500
            );
        }

        return $response;
    }