protected function requireRole(Request $request, Response $response, $role, $message = null)
    {
        $user = $this->container['sentinel']->getUser();

        if (null === $user) {
            throw $this->unauthorizedException($request, $response);
        }

        if (!$user->inRole($role)) {
            throw $this->accessDeniedException(
                $request,
                $response,
                null === $message ? 'Access denied: User must have role '.$role : $message
            );
        }
    }