public void GetCommercials()
        {
            try
            {
                response = new List <CommercialBreak>();
                CommercialBreak commercial;
                int             commercialIndex = 0;
                foreach (BreakItems brk in breaks)
                {
                    commercial = new CommercialBreak
                    {
                        BreakName = (string.IsNullOrEmpty(Convert.ToString(brk.Break)) ? BreakTypesEnum.NoBreak : brk.Break),
                        //BreakName = brk.Break,
                        Demographic    = brk.Demographic,
                        Rating         = brk.Rating,
                        CommercialName = commercials.ElementAt(commercialIndex).CommercialName,
                        CommercialType = commercials.ElementAt(commercialIndex).CommercialType
                    };
                    commercialIndex++;
                    response.Add(commercial);
                }
            }
            catch (Exception)
            { }

            //return response;
        }
        public IEnumerable <CommercialBreak> OptimisedCommercials(bool isUneven)
        {
            try
            {
                response = new List <CommercialBreak>();
                List <CommercialBreak> tmpCommBrk = new List <CommercialBreak>();
                CommercialBreak        commercial;
                foreach (BreakItems brk in breaks)
                {
                    //find commercials with same demographic
                    List <CommercialItems> commByDemographic = (brk.Break != BreakTypesEnum.Break2) ? commercials.Where(x => x.Demographic == brk.Demographic && !x.isAllocated).ToList() :
                                                               commercials.Where(x => x.Demographic == brk.Demographic && x.CommercialType != CommercialTypeEnum.Finance && !x.isAllocated).ToList();

                    var commTypeName = commByDemographic.Where(x => !x.isAllocated).FirstOrDefault().CommercialType;
                    var commName     = commByDemographic.Where(x => !x.isAllocated).FirstOrDefault().CommercialName;
                    if (commByDemographic.Count() > 0 && ValidateSameTypeCommercialsInBreak1(commTypeName, brk.Break, isUneven))
                    {
                        commercial = new CommercialBreak
                        {
                            BreakName      = brk.Break,
                            Demographic    = brk.Demographic,
                            Rating         = brk.Rating,
                            CommercialName = commByDemographic.Where(x => !x.isAllocated).FirstOrDefault().CommercialName,
                            CommercialType = commByDemographic.Where(x => !x.isAllocated).FirstOrDefault().CommercialType
                        };

                        response.Add(commercial);

                        commercials.Where(x => x.CommercialName == commName).FirstOrDefault().isAllocated = true;
                    }
                }
                GetOptimsedRatings(response);
            }
            catch (Exception ex)
            { }

            return(response);
        }