public static ObjectResult GetMostRecentPromotionEvent(ILogger log, int promotionId, Session session)
        {
            //throw new NotImplementedException();
            var promotionEvent = MMADataService.GetMostRecentPromotionEvent(promotionId, ref DbContext);

            if (promotionEvent == null)
            {
                return(BuildNotFoundErrorResponse(session, true));
            }
            else
            {
                return(ParseResultsToSpeach(promotionEvent, log, session, false));
            }
        }
        public static ObjectResult GetPromotionEventByDate(ILogger logger, DateTime date, int promotionId, Session session)
        {
            var promotionEvent = MMADataService.GetPromotionMeetingByDate(date, promotionId, ref DbContext);

            if (promotionEvent == null)
            {
                return(BuildNotFoundErrorResponse(session, true));
            }
            else
            {
                //Process Event Results
                return(ParseResultsToSpeach(promotionEvent, logger, session, false));
            }
        }
        public static ObjectResult GetEventsByDate(ILogger logger, DateTime date, Session session)
        {
            var promotionEvent = MMADataService.GetEventsByDate(date, ref DbContext);

            if (promotionEvent == null)
            {
                return(BuildNotFoundErrorResponse(session, true));
            }
            else
            {
                //process the list of event results - prompt the user wiht options and read the one they ask
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// This method takes the globally available EventResultsContent nodes and iterates over them, in the process attempting
        /// to create a new PromotionMeeting instance, checking for an existing record, before then creating or updating both the maincard and undercard
        /// results. To be split up at a future point.
        /// </summary>
        private void ProcessEventResults()
        {
            var counter = 0;

            foreach (var node in EventResultsContentNodes.Elements())
            {
                Console.WriteLine("Promotion meeting process entry");
                var promotionMeeting = new PromotionMeeting();

                if (!(EventDateNodes.Count > counter))
                {
                    Console.WriteLine("End of results.");
                    break;
                }

                DateTime promotionDate = ProcessTimeNode(EventDateNodes.ElementAt(counter));
                promotionMeeting.Title = ProcessEventTitle(EventTitleNodes.ElementAt(counter), out int promotionId);

                Console.WriteLine("Checking for existing promotion meeting..");
                if (MMADataService.DoesPromotionMeetingExist(promotionDate, promotionId, ref DbContext))
                {
                    promotionMeeting = MMADataService.GetPromotionMeetingByDate(promotionDate, promotionId, ref DbContext);
                    if (promotionMeeting.FightResults != null)
                    {
                        promotionMeeting.FightResults.Clear(); //update with latest results
                    }
                    else
                    {
                        promotionMeeting.FightResults = new List <FightResult>();
                    }
                    Console.WriteLine("found..");
                }
                else
                {
                    Console.WriteLine("new promotion meeting..");
                    // assign promoiton via id search
                    promotionMeeting.PromotionId  = promotionId;
                    promotionMeeting.Date         = promotionDate;
                    promotionMeeting.FightResults = new List <FightResult>();

                    MMADataService.AddPromotionMeeting(promotionMeeting, ref DbContext);
                    MMADataService.SaveChanges(ref DbContext);
                }

                Console.WriteLine("Get fight result nodes..");
                // get results nodes
                var fightResultNodes = node.SelectNodes("//div[@class='m-mmaf-pte-event-list__split']"); //[1] mc, [2] uc [3] mc

                var mainCardNode  = new List <HtmlNode>();
                var underCardNode = new List <HtmlNode>();

                //main card
                Console.WriteLine("adding main card nodes..");
                for (int i = 0; i < fightResultNodes.Count(); i++)
                {
                    mainCardNode.Add(fightResultNodes[i].Descendants("div").ElementAt(0));
                }

                //under card
                Console.WriteLine("adding under card nodes..");
                for (int i = 0; i < fightResultNodes.Count(); i++)
                {
                    underCardNode.Add(fightResultNodes[i].Descendants("div").ElementAt(1));
                }

                int fightNumber = 0;

                if (mainCardNode.Count > counter)
                {
                    //process maincard
                    foreach (var fightResultNode in mainCardNode[counter].Descendants("li"))
                    {
                        var fightResult = new FightResult();
                        fightResult.FightNumber      = fightNumber;
                        fightResult.PromotionMeeting = promotionMeeting;
                        fightResult.IsMainCard       = true;

                        if (ProcessFighterNames(fightResultNode.Descendants("a").FirstOrDefault().InnerHtml, out string[] fighterNames))