//[GridAction]
        //public ActionResult _ExclusiveEpisodes()
        //{
        //    return View(new GridModel<EpisodeDisplayMiniImage> { Data = GetFeatureEpisodes() });
        //}

        private List<EpisodeDisplayMiniImage> GetFeatureEpisodes()
        {
            List<EpisodeDisplayMiniImage> display = null;
            var cache = DataCache.Cache;
            string cacheKey = "UAAPPagesExclusiveFeatureCacheKey";
            display = (List<EpisodeDisplayMiniImage>)cache[cacheKey];
            if (display == null)
            {
                var id = GlobalConfig.UAAPExclusiveFeaturesId;
                DateTime registDt = DateTime.Now;
                display = new List<EpisodeDisplayMiniImage>();
                var context = new IPTV2Entities();

                var featureItems = context.FeatureItems.Where(f => f.FeatureId == id && f.StatusId == GlobalConfig.Visible);
                int epCount = featureItems.Count();
                foreach (var item in featureItems)
                {
                    if (item is EpisodeFeatureItem)
                    {
                        var episodeFeatureItem = (EpisodeFeatureItem)item;
                        var episode = episodeFeatureItem.Episode;
                        string EpLength = String.Empty;
                        if (!(episode.EpisodeLength == null))
                        {
                            TimeSpan span = new TimeSpan(0, 0, Convert.ToInt32(episode.EpisodeLength) * 60);
                            EpLength = String.Format("{0}:{1}:{2}", span.Hours.ToString().PadLeft(2, '0'), span.Minutes.ToString().PadLeft(2, '0'), span.Seconds.ToString().PadLeft(2, '0'));
                        }

                        EpisodeDisplayMiniImage disp = new EpisodeDisplayMiniImage()
                        {
                            EpisodeId = episode.EpisodeId,
                            EpisodeName = episode.Synopsis,
                            Description = episode.Description,
                            DateAired = episode.DateAired,
                            DateAiredStr = episode.DateAired.Value.ToString("MMM d, yyyy"),
                            EpisodeLength = episode.EpisodeLength,
                            EpisodeNumber = epCount,
                            EpLength = EpLength,
                            ImageSmall = GlobalConfig.EpisodeImgPath + episode.EpisodeId.ToString() + "/" + episode.ImageAssets.ImageVideo
                        };
                        display.Add(disp);
                        epCount--;
                    }
                }
                cache.Put(cacheKey, display, DataCache.CacheDuration);
            }
            return display;
        }
        //[GridAction]
        //public ActionResult _GameEpisodes(int? id)
        //{
        //    return View(new GridModel<EpisodeDisplayMiniImage> { Data = GetGameEpisodes(id) });
        //}

        private List<EpisodeDisplayMiniImage> GetGameEpisodes(int? id)
        {
            List<EpisodeDisplayMiniImage> display = null;
            if (id != null)
            {
                var cache = DataCache.Cache;
                string cacheKey = "UAAPGGESS;I:" + id;
                display = (List<EpisodeDisplayMiniImage>)cache[cacheKey];
                if (display == null)
                {
                    DateTime registDt = DateTime.Now;
                    display = new List<EpisodeDisplayMiniImage>();
                    var context = new IPTV2Entities();

                    var ep = context.Episodes.FirstOrDefault(e => e.EpisodeId == id);
                    var CacheDuration = new TimeSpan(0, GlobalConfig.GetParentShowsForEpisodeCacheDuration, 0);
                    var parentShows = ep.GetParentShows(CacheDuration);
                    parentShows.Remove(GlobalConfig.UAAPMainCategoryId);
                    var episodeIds = context.EpisodeCategories1.Where(e => parentShows.Contains(e.CategoryId)).Select(e => e.EpisodeId);
                    var episodes = context.Episodes.Where(e => episodeIds.Contains(e.EpisodeId) && e.OnlineStatusId == GlobalConfig.Visible && e.OnlineStartDate < registDt && e.OnlineEndDate > registDt);
                    int epCount = episodes.Count();
                    ViewBag.sCount = epCount;
                    foreach (var episode in episodes)
                    {
                        if (episode.EpisodeId != id)
                        {
                            string EpLength = String.Empty;
                            if (episode.EpisodeLength != null)
                            {
                                TimeSpan span = new TimeSpan(0, 0, Convert.ToInt32(episode.EpisodeLength) * 60);
                                EpLength = String.Format("{0}:{1}:{2}", span.Hours.ToString().PadLeft(2, '0'), span.Minutes.ToString().PadLeft(2, '0'), span.Seconds.ToString().PadLeft(2, '0'));
                            }

                            EpisodeDisplayMiniImage disp = new EpisodeDisplayMiniImage()
                            {
                                EpisodeId = episode.EpisodeId,
                                EpisodeName = episode.Synopsis,
                                Description = episode.Description,
                                DateAired = episode.DateAired,
                                DateAiredStr = episode.DateAired.Value.ToString("MMM d, yyyy"),
                                EpisodeLength = episode.EpisodeLength,
                                EpisodeNumber = epCount,
                                EpLength = EpLength,
                                ImageSmall = GlobalConfig.EpisodeImgPath + episode.EpisodeId.ToString() + "/" + episode.ImageAssets.ImageVideo
                            };
                            display.Add(disp);
                            epCount--;
                        }
                    }
                    cache.Put(cacheKey, display, DataCache.CacheDuration);
                }
            }
            return display;
        }
        //[ChildActionOnly]
        //[OutputCache(VaryByParam = "*", Duration = 300)]
        //public PartialViewResult GetPackages(int categoryId, string countryCode)
        //{
        //    ShowPackageProductPrices showPackageProductPrices = new ShowPackageProductPrices();
        //    try
        //    {
        //        showPackageProductPrices = showPackageProductPrices.LoadAllPackageAndProduct(categoryId, countryCode, true);
        //        //if (showPackageProductPrices == null)
        //        //    return null;
        //    }
        //    catch (Exception e) { MyUtility.LogException(e); }
        //    return PartialView("_GetShowProductPackagesVertical", showPackageProductPrices);
        //}

        //[ChildActionOnly]
        //[OutputCache(VaryByParam = "*", Duration = 300)]
        //public PartialViewResult GetPackages2(ShowPackageProductPrices showPackageProductPrices)
        //{
        //    return PartialView("_GetShowProductPackagesVertical", showPackageProductPrices);
        //}

        //[GridAction]
        //public ActionResult _ShowEpisodes()
        //{
        //    return View(new GridModel<EpisodeDisplayMiniImage> { Data = GetShowEpisodes() });
        //}

        private List<EpisodeDisplayMiniImage> GetShowEpisodes()
        {
            List<EpisodeDisplayMiniImage> display = null;
            var cache = DataCache.Cache;
            string cacheKey = "UAAPPagesCacheKeyShowEpisodes";
            display = (List<EpisodeDisplayMiniImage>)cache[cacheKey];
            if (display == null)
            {
                var id = GlobalConfig.UAAPGamesParentId;
                display = new List<EpisodeDisplayMiniImage>();
                DateTime registDt = DateTime.Now;
                var context = new IPTV2Entities();
                var service = context.Offerings.Find(GlobalConfig.offeringId).Services.FirstOrDefault(s => s.PackageId == GlobalConfig.serviceId);
                var cats = (Category)context.CategoryClasses.Find(GlobalConfig.UAAPGamesParentId);
                var listOfShows = service.GetAllOnlineShowIds(GlobalConfig.DefaultCountry, cats);
                var episodeIds = context.EpisodeCategories1.Where(e => listOfShows.Contains(e.CategoryId)).Select(e => e.EpisodeId);
                var episodeList = context.Episodes.Where(e => episodeIds.Contains(e.EpisodeId) && e.OnlineStatusId == GlobalConfig.Visible && e.OnlineStartDate < registDt && e.OnlineEndDate > registDt).OrderByDescending(e => e.DateAired).ThenBy(e => e.AuditTrail.CreatedOn);

                int epCount = episodeList.Count();
                ViewBag.sCount = epCount;
                foreach (var episode in episodeList)
                {
                    string EpLength = String.Empty;
                    if (!(episode.EpisodeLength == null))
                    {
                        TimeSpan span = new TimeSpan(0, 0, Convert.ToInt32(episode.EpisodeLength) * 60);
                        EpLength = String.Format("{0}:{1}:{2}", span.Hours.ToString().PadLeft(2, '0'), span.Minutes.ToString().PadLeft(2, '0'), span.Seconds.ToString().PadLeft(2, '0'));
                    }

                    EpisodeDisplayMiniImage disp = new EpisodeDisplayMiniImage()
                    {
                        EpisodeId = episode.EpisodeId,
                        EpisodeName = episode.Synopsis,
                        Description = episode.Description,
                        DateAired = episode.DateAired,
                        DateAiredStr = episode.DateAired.Value.ToString("MMM d, yyyy"),
                        EpisodeLength = episode.EpisodeLength,
                        EpisodeNumber = epCount,
                        EpLength = EpLength,
                        ImageSmall = GlobalConfig.EpisodeImgPath + episode.EpisodeId.ToString() + "/" + episode.ImageAssets.ImageVideo
                    };
                    display.Add(disp);
                    epCount--;
                }
                cache.Put(cacheKey, display, DataCache.CacheDuration);
            }
            return display;
        }