private static function setAttribute(ServerRequestInterface $request, $name, $value)
    {
        $attributes = $request->getAttribute(Middleware::KEY, []);
        $attributes[$name] = $value;

        return $request->withAttribute(Middleware::KEY, $attributes);
    }