public static RobotDto GetRobot(RobotDto[] robots, string robotName)
        {
            RobotDto robot = robots.SingleOrDefault(r => r.Name == robotName);

            //string jsonRobot = JsonConvert.SerializeObject(robot, Formatting.Indented);
            //Console.WriteLine(jsonRobot);
            return(robot);
        }
        public static JobDto GetJobDetails(string token, int jobId)
        {
            JobDto job     = null;
            var    client  = new RestClient(baseUrl + "/odata/Jobs(" + jobId + ")?$expand=Robot,Release");
            var    request = new RestRequest(Method.GET);

            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Authorization", "Bearer " + token);

            IRestResponse response = client.Execute(request);

            if ((int)response.StatusCode == 200)
            {
                Console.WriteLine("GetJobDetails - Success : " + response.StatusCode);

                JObject jContent           = JObject.Parse(response.Content);
                string  Key                = jContent["Key"].ToString();
                string  StartTime          = jContent["StartTime"].ToString();
                string  EndTime            = jContent["EndTime"].ToString();
                string  State              = jContent["State"].ToString();
                string  Source             = jContent["Source"].ToString();
                string  BatchExecutionKey  = jContent["BatchExecutionKey"].ToString();
                string  Info               = jContent["Info"].ToString();
                string  CreationTime       = jContent["CreationTime"].ToString();
                string  StartingScheduleId = jContent["StartingScheduleId"].ToString();
                int     Id = int.Parse(jContent["Id"].ToString());

                ReleaseDto release = JsonConvert.DeserializeObject <ReleaseDto>(jContent["Release"].ToString());
                RobotDto   robot   = JsonConvert.DeserializeObject <RobotDto>(jContent["Robot"].ToString());

                job = new JobDto()
                {
                    Key                = Key,
                    StartTime          = StartTime,
                    EndTime            = EndTime,
                    State              = State,
                    Source             = Source,
                    BatchExecutionKey  = BatchExecutionKey,
                    Info               = Info,
                    CreationTime       = CreationTime,
                    StartingScheduleId = StartingScheduleId,
                    Id      = Id,
                    Release = release,
                    Robot   = robot
                };
            }
            else
            {
                Console.WriteLine("GetJobDetails - Failed : " + response.StatusCode);
            }

            return(job);
        }