public static string UpdateRobotsWithNewMachineName(string token, Robots robot, string newMachineName, long newMachineId)

        {
            try
            {
                var modifiedRobot = new ModifiedRobot
                {
                    MachineId   = newMachineId,
                    MachineName = newMachineName
                };

                var jsonString = JsonConvert.SerializeObject(modifiedRobot);

                HttpContent httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
                HttpClient  httpClient  = new HttpClient();
                httpClient.DefaultRequestHeaders.Remove("Authorization");
                httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);

                string newPatchurl = String.Concat(ApiDetails.PatchRobotDetailsUrl(), "(", robot.Id.ToString(), ")");

                Uri newPatchUri = new Uri(newPatchurl);

                var responseMessage = httpClient.PatchAsync(newPatchUri, httpContent).Result;

                return(responseMessage.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception : " + ex.Message);
                Console.WriteLine("Stack Trace : " + ex.StackTrace);

                throw;
            }
        }
        public static List <Robots> GetRobotsDetails(string robotResponse, string oldMachineName, long oldMachineId)
        {
            try
            {
                JObject rss           = JObject.Parse(robotResponse);
                var     robotsDetails = JObject.Parse(robotResponse)["value"]
                                        .ToList();

                //JObject jalbum = robotsDetails[0] as JObject;
                //// Copy to a static Album instance
                //Robots album = jalbum.ToObject<Robots>();

                List <Robots> RobotsList = new List <Robots>();

                foreach (var robotdetail in robotsDetails)
                {
                    JObject Jrbt = robotdetail as JObject;
                    Robots  rbt  = Jrbt.ToObject <Robots>();
                    RobotsList.Add(rbt);
                }

                var x = RobotsList.
                        Where(a => a.MachineId == oldMachineId && a.MachineName == oldMachineName).ToList();

                Console.Write("Total Robots Count tobe updated in RainbowCafe " + x.Count);

                return(x);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception : " + ex.Message);
                Console.WriteLine("Stack Trace : " + ex.StackTrace);


                return(null);
            }
        }