private static void AlertPersonToNewRound(PersonModel p, string teamName, MatchUpEntryModel competitor)
        {
            if (string.IsNullOrWhiteSpace(p.EmailAddress))
            {
                return;
            }

            string        to      = "";
            string        subject = "";
            StringBuilder body    = new StringBuilder();

            if (competitor != null)
            {
                subject = $"You have a new matchup with {competitor.TeamCompeting.TeamName}.";
                body.AppendLine("<h1>You have a new matchup</h1>");
                body.Append("<strong>Competitor: </strong>");
                body.Append(competitor.TeamCompeting.TeamName);
                body.AppendLine();
                body.AppendLine();
                body.AppendLine("Have a great time!!");
                body.AppendLine("~Tournament Tracker");
            }
            else
            {
                subject = $"You have a bye week this round.";
                body.AppendLine("Enjoy your week off.");
                body.AppendLine("~Tournament Tracker");
            }

            to = p.EmailAddress;

            EmalLogic.SendEmail(to, subject, body.ToString());
        }
        private static void CompleteTournament(TournamentModel model)
        {
            TeamModel winners = model.Rounds.Last().First().Winner;
            //model.WinnerId = winners.Id;
            TeamModel runnerUp = model.Rounds.Last().First().Entries.Where(x => x.TeamCompeting != winners).First().TeamCompeting;

            model.DateFinished = DateTime.Now;
            model.Winner       = winners;

            GlobalConfig.Connection.CompleteTournament(model);

            decimal winnerPrize   = 0;
            decimal runnerUpPrize = 0;

            PrizeModel firstPlacePrize  = model.Prizes.Where(x => x.PlaceNumber == 1).FirstOrDefault();
            PrizeModel secondPlacePrize = model.Prizes.Where(x => x.PlaceNumber == 2).FirstOrDefault();

            if (model.Prizes.Count > 0)
            {
                decimal totalIncome = model.EnteredTeams.Count * model.EntryFee;

                if (firstPlacePrize != null)
                {
                    winnerPrize = firstPlacePrize.CalculatePrizePayout(totalIncome);
                }
                if (secondPlacePrize != null)
                {
                    runnerUpPrize = secondPlacePrize.CalculatePrizePayout(totalIncome);
                }
            }

            // Send email to all tournament.

            //string to = "";
            string        subject = "";
            StringBuilder body    = new StringBuilder();


            subject = $"In {model.TournamentName} {winners.TeamName} has won!";
            body.AppendLine("<h1>We have a WINNER!</h1>");
            body.Append("<P>Congratulations to our winner ou a great Tournament. </P>");
            body.AppendLine("<br/>");

            if (winnerPrize > 0)
            {
                body.AppendLine($"<p>The winnar {winners.TeamName} will receive ${winnerPrize}</p>");
            }
            if (runnerUpPrize > 0)
            {
                body.AppendLine($"<p>The runnerup {runnerUp.TeamName} will receive ${runnerUpPrize}</p>");
            }

            body.AppendLine("<p>Thanks for a great tournament!!</p>");
            body.AppendLine("~Tournament Tracker");

            List <string> bcc = new List <string>();

            foreach (TeamModel t in model.EnteredTeams)
            {
                foreach (PersonModel p in t.TeamMembers)
                {
                    if (!string.IsNullOrWhiteSpace(p.EmailAddress))
                    {
                        bcc.Add(p.EmailAddress);
                    }
                }
            }


            EmalLogic.SendEmail(new List <string>(), bcc, subject, body.ToString());

            //Complete Tournament
            //model.DateFinished = DateTime.Now;
            //model.Winner = winners;
            model.CompleteTournament();
        }