public static Response ProcessRequest(Request request, List<Device> devices)
        {
            IPTVLib.RequestModel.Response response = new IPTVLib.RequestModel.Response();
              response.Successful = false;
              response.FailReason = "Unable to process request. Bad Data.";
              //Process Request
              //Build a request to send on to the relevant devices
              IPTVLib.RequestModel.Request responseRequest = new IPTVLib.RequestModel.Request();
              response.Successful = true;

              //Switch and do something using the given data
              switch (request.Action)
              {
            case RequestAction.RequestHosts:
              response = ProcessHostsRequest(request, devices, response, responseRequest);
              break;
            case RequestAction.RequestRemotes:
              response = ProcessRemotesRequest(request, devices, response, responseRequest);
              break;
            case RequestAction.RequestDevices:
              response = ProcessDevicesRequest(request, devices, response, responseRequest);
              break;
            default:
              response = PassThroughRequest(request, devices, responseRequest, response); // By Default just pass the request on to the specified devices -- ones that require extra processing are above
              break;
              }//switch
              //Return the response
              return response;
        }
        public ActionResult ProcessRequest()
        {
            List<Device> devices = new List<Device>();
              Request request = null;
              //Convert request to object so it is readable
              try
              {
            devices = JsonConvert.DeserializeObject<List<Device>>(Request["devices"]);
            request = JsonConvert.DeserializeObject<Request>(Request["request"]);
              }
              catch (Exception ex)
              {
            IPTVLib.RequestModel.Response response = new IPTVLib.RequestModel.Response();
            response.Successful = false;
            response.FailReason = "Unable to process request. Bad Data.";
            return this.Json(response);
              }//catch

              //Return the JSON
              return this.Json(RequestProcessorService.ProcessRequest(request, devices));
        }