public static ReleaseDto GetReleaseByEnvName(ReleaseDto[] releases, string envName)
        {
            ReleaseDto release     = releases.SingleOrDefault(r => r.EnvironmentName == envName);
            string     jsonRelease = JsonConvert.SerializeObject(release, Formatting.Indented);

            Console.WriteLine(jsonRelease);
            return(release);
        }
        public static ReleaseDto GetReleaseByProcessName(ReleaseDto[] releases, string processName)
        {
            ReleaseDto release     = releases.SingleOrDefault(r => r.ProcessKey == processName);
            string     jsonRelease = JsonConvert.SerializeObject(release, Formatting.Indented);

            Console.WriteLine(jsonRelease);
            return(release);
        }
        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);
        }