public static IEnumerable <ProtectionRunInstance> GetProtectionJobRunsByJobId(RestApiClient client, long jobId)
        {
            var qb = new QuerystringBuilder();

            qb.Add("jobId", jobId);

            var preparedUrl = $"/public/protectionRuns{qb.Build()}";
            var jobRuns     = client.Get <IEnumerable <ProtectionRunInstance> >(preparedUrl);

            if (jobRuns == null || !jobRuns.Any())
            {
                throw new Exception("Protection job runs with matching job id not found.");
            }

            return(jobRuns);
        }
        public static ProtectionJob GetProtectionJobByName(RestApiClient client, string name)
        {
            var qb = new QuerystringBuilder();

            qb.Add("includeLastRunAndStats", true);

            var preparedUrl = $"/public/protectionJobs{qb.Build()}";
            var jobs        = client.Get <IEnumerable <ProtectionJob> >(preparedUrl);

            if (jobs == null || !jobs.Any())
            {
                throw new Exception("Protection job with matching name not found.");
            }

            var job = jobs.FirstOrDefault(i => i.Name.Equals(name));

            if (job == null)
            {
                throw new Exception("Protection job with matching name not found.");
            }

            return(job);
        }
        public static View GetViewByName(RestApiClient client, string name)
        {
            var qb = new QuerystringBuilder();

            qb.Add("includeInactive", true);

            var preparedUrl = $"/public/views{qb.Build()}";
            var result      = client.Get <GetViewsResult>(preparedUrl);

            if (result == null)
            {
                throw new Exception("View with matching name not found.");
            }

            var view = result.Views.FirstOrDefault(i => i.Name.Equals(name));

            if (view == null)
            {
                throw new Exception("View with matching name not found.");
            }

            return(view);
        }