private Task <dynamic> Proxy(dynamic parameters, CancellationToken ct)
        {
            return(Task <dynamic> .Factory.StartNew(() =>
            {
                this.RequiresAuthentication();
                this.RequiresAnyClaim(new[] { "superuser", "device-proxy-all", string.Format("device-proxy-{0}", (int)parameters.id) });

                var device = _connection.SingleById <Device>((int)parameters.id);
                if (device == null)
                {
                    return Negotiate
                    .WithStatusCode(HttpStatusCode.NotFound)
                    .WithModel(new { Error = string.Format("Unknown Device ID ({0})", parameters.id) });
                }

                var httpResponse = Proxy(new CoapDotNetHttpRequest(Request, device.Url + "/" + (string)parameters.endpoint), new Uri("coap://" + device.Url + "/" + (string)parameters.endpoint));
                if (httpResponse == null)
                {
                    return HttpStatusCode.GatewayTimeout;
                }

                //Send HTTP response
                httpResponse.OutputStream.Position = 0;
                return Response
                .FromStream(httpResponse.OutputStream, httpResponse.ContentType)
                .WithHeaders(httpResponse.Headers.ToArray())
                .WithStatusCode(httpResponse.StatusCode)
                .AsCacheable(DateTime.Now + TimeSpan.FromSeconds(httpResponse.MaxAge));
            }, ct));
        }