public IEnumerable<Video> GetActiveJobs()
        {
            var activeJobs = this.context.Videos.Where(v => !string.IsNullOrEmpty(v.JobId));

            if (activeJobs.Any())
            {
                var mediaContext = new CloudMediaContext(
                                                 CloudConfigurationManager.GetSetting("MediaServicesAccountName"),
                                                 CloudConfigurationManager.GetSetting("MediaServicesAccountKey"));

                foreach (var video in activeJobs)
                {
                    var job = mediaContext.GetJob(video.JobId);
                    if (job != null)
                    {
                        // The video status will be Encoding unless the encoding job is finished or error
                        video.JobStatus = (job.State == JobState.Finished || job.State == JobState.Error)
                                            ? JobStatus.Completed : JobStatus.Encoding;

                        yield return video;
                    }
                }
            }

            yield break;
        }