public int CallingSheets(Document doc, int showId, int ringId, PdfWriter writer, int position = -1)
        {
            doc.Open();
            var font = new Font(Font.COURIER, 10, Font.NORMAL, Color.BLACK);
            var fontBold = new Font(Font.COURIER, 10, Font.BOLD, Color.BLACK);
            var sc = new ShowClasses();
            var currentRing = new Rings(ringId);
            var showClasses = ShowClasses.GetAllClassesForShowRing(showId, ringId, position);
            var ret = showClasses.Count;
            float[] colWidthsStandard = { 35, 35, 50, 200, 200 };
            float[] colWidthsTeam = { 35, 200, 200 };
            PdfPTable callingListTbl = null;
            var currentClassNo = 0;
            var multiClasses = TeamPairsManager.GetTeamPairClasses(showId);
            var multiTeams = TeamPairsManager.GetTeamPairsForShow(showId, multiClasses);
            foreach (var showClass in showClasses)
            {
                var colWidths = (TeamPairsManager.isMultiDog(showClass.EntryType) ? colWidthsTeam : colWidthsStandard);
                if (currentClassNo != showClass.ClassNo)
                {
                    if (currentClassNo != 0)
                    {

                    }
                    callingListTbl =
                        new PdfPTable(colWidths)
                        {
                            HeaderRows = 2
                        };
                }
                string tmp;
                if (TeamPairsManager.isMultiDog(showClass.EntryType) || showClass.EntryType == 10)
                {
                    tmp =
                        $"Ring No:{currentRing.RingNo}   Class No:{showClass.ClassNo} {showClass.longHeight} {showClass.LongClassName} {showClass.ClassName}";
                }
                else
                {
                    //                    tmp = String.Format("Ring No:{5}   Class No:{0} {1} {2} {3} {6} {7} {4}", showClass.ClassNo, showClass.longHeight, showClass.longCatagory, showClass.LongClassName, grades, currentRing.RingNo, showClass.ClassName, (showClass.Part > 0 ? "Part " + showClass.Part : ""));
                    tmp = $"Ring No:{currentRing.RingNo}   Class No:{showClass.NormalName()}";
                    tmp += $" {(showClass.Part > 0 ? "Part " + showClass.Part : "")}";
                }
                var cell = new PdfPCell(new Phrase(new Chunk(tmp, ClassTitleFont)))
                {
                    Colspan = colWidths.Length,
                    BorderWidth = 0,
                    FixedHeight = 40F
                };
                callingListTbl.AddCell(cell);

                cell = new PdfPCell(new Phrase(new Chunk("", ClassTitleFont)))
                {
                    Colspan = colWidths.Length,
                    BorderWidth = 0
                };
                callingListTbl.AddCell(cell);
                doc.Add(callingListTbl);
                callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("RO", headerFont))) { BorderWidth = 0, HorizontalAlignment = Element.ALIGN_RIGHT});

                if (!TeamPairsManager.isMultiDog(showClass.EntryType))
                {
                    callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(" ", headerFont))) { BorderWidth = 0 });
                    callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Ring No", headerFont))) { BorderWidth = 0, HorizontalAlignment =  Element.ALIGN_RIGHT});
                }
                callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Handler", headerFont))) { BorderWidth = 0 });
                callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Dog Name", headerFont))) { BorderWidth = 0 });
                doc.Add(callingListTbl);
                int altFlag = 0;
                Color altLine = Color.LIGHT_GRAY;
                callingListTbl = new PdfPTable((TeamPairsManager.isMultiDog(showClass.EntryType) ? colWidthsTeam : colWidths));
                if (TeamPairsManager.isMultiDog(showClass.EntryType))
                {
                    var teamsForClass = multiTeams.Where(t => t.ClassId == showClass.ID).OrderBy(t => t.RO);

                    foreach (var team in teamsForClass)
                    {
                        var altColor = Color.WHITE;
                        if (altFlag % 2 == 0 && showClass.EntryType != 5)
                        {
                            altColor = altLine;
                        }

                        cell = new PdfPCell(new Phrase(new Chunk(team.RO.ToString(), headerHFont)))
                        {
                            BorderWidth = 0,
                            BackgroundColor = altColor
                        };
                        callingListTbl.AddCell(cell);

                        if (TeamPairsManager.isTeam(showClass.EntryType))
                        {
                            cell =
                                new PdfPCell(
                                    new Phrase(new Chunk("Team Name:" + team.TeamDetails.TeamName.Replace("'", "'"),
                                        headerHFont)))
                                {
                                    BackgroundColor = altColor,
                                    BorderWidth = 0
                                };
                            callingListTbl.AddCell(cell);

                            cell =
                                new PdfPCell(
                                    new Phrase(new Chunk("Captain:" + team.TeamDetails.Captain.Replace("'", "'"),
                                        headerHFont)))
                                {
                                    BackgroundColor = altColor,
                                    BorderWidth = 0
                                };
                            callingListTbl.AddCell(cell);

                            cell = new PdfPCell(new Phrase(new Chunk("", headerHFont)))
                            {
                                BackgroundColor = altColor,
                                BorderWidth = 0
                            };
                            callingListTbl.AddCell(cell);
                        }

                        var dogCnt = 0;
                        var handlerPara = new Paragraph();
                        var dogPara = new Paragraph();
                        foreach (var member in team.Members)
                        {
                            if (dogCnt < team.DogCount)
                            {
                                if (dogCnt > 0)
                                {
                                    handlerPara.Add(new Phrase(Chunk.NEWLINE));
                                    dogPara.Add(new Phrase(Chunk.NEWLINE));
                                }

                                handlerPara.Add(new Phrase(new Chunk(Utils.TitleCaseString(member.HandlerName).Replace("&#39;", "'"), font)));
                                dogPara.Add(new Phrase(new Chunk(Utils.TitleCaseString(member.DogName).Replace("&#39;", "'"), font)));
                            }
                            dogCnt++;
                        }
                        cell = new PdfPCell(handlerPara)
                        {
                            BorderWidth = 0,
                            BorderWidthTop = 0,
                            BackgroundColor = altColor
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(dogPara)
                        {
                            BorderWidth = 0,
                            BorderWidthTop = 0,
                            BackgroundColor = altColor
                        };
                        callingListTbl.AddCell(cell);
                        doc.Add(callingListTbl);

                        altFlag++;
                        callingListTbl = new PdfPTable((TeamPairsManager.isMultiDog(showClass.EntryType) ? colWidthsTeam : colWidths));

                        var lineLeft = writer.GetVerticalPosition(false) - doc.BottomMargin;
                        if (lineLeft < 50)
                        {
                            doc.NewPage();
                        }
                    }
                }
                else
                {
                    var callingList = sc.GetCallingList(showId, showClass.ID);
                    foreach (var item in callingList)
                    {

                        Color altColor = Color.WHITE;
                        if (altFlag % 2 == 0 && showClass.EntryType != 5)
                        {
                            altColor = altLine;
                        }

                        callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk($"{item.Ro}", font)))
                        {
                            BorderWidth = 0,
                            BackgroundColor = altColor,
                            HorizontalAlignment = Element.ALIGN_RIGHT
                        });

                        var borderWidth = 0;
                        callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(item.Lho == 0 ? "" : "LHO", font)))
                        {
                            HorizontalAlignment = Element.ALIGN_RIGHT,
                            BackgroundColor = altColor,
                            BorderWidth = borderWidth
                        });
                        callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk($"{item.RingNumber}", font)))
                        {
                            HorizontalAlignment = Element.ALIGN_CENTER,
                            BackgroundColor = altColor,
                            BorderWidth = borderWidth
                        });

                        var handlerName = Utils.TitleCaseString(item.Name);
                        User user;
                        var namePhrase = new Phrase();
                        var us = new UserShows(item.UserId, showId);
                        if (item.DefaultHandlerId > 0)
                        {
                            user = new User(item.DefaultHandlerId);
                            handlerName = user.Name;
                        }
                        if (item.AltHandlerId > 0)
                        {
                            user = new User(item.AltHandlerId);
                            handlerName = user.Name;
                        }

                        if (us.HandlerType == (int)Core.Enums.DiscountTypes.Member)
                        {
                            namePhrase.Add(new Chunk("(M)", fontBold));
                            namePhrase.Add(new Chunk(Utils.TitleCaseString(handlerName), fontBold));
                        }
                        else
                        {
                            namePhrase.Add(new Chunk(Utils.TitleCaseString(handlerName), font));
                        }
                        cell = new PdfPCell(namePhrase)
                        {
                            BackgroundColor = altColor,
                            BorderWidth = borderWidth
                        };
                        callingListTbl.AddCell(cell);

                        cell =
                            new PdfPCell(
                                new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(item.KcName), font)))
                            {
                                BackgroundColor = altColor,
                                BorderWidth = borderWidth
                            };
                        callingListTbl.AddCell(cell);

                        altFlag++;
                    }
                    doc.Add(callingListTbl);
                }
                doc.NewPage();
            }
            return ret;
        }
        public int ScoreBoards(Document doc, int showId, int ringId, int position = -1)
        {
            var ret = 0;
            var bigBoyFont = new Font(Font.HELVETICA, 20, Font.BOLD, Color.BLACK);
            var sc = new ShowClasses();
            var currentRing = new Rings(ringId);
            var showClasses = ShowClasses.GetAllClassesForShowRing(showId, ringId, position);
            ret = showClasses.Count;
            float[] colWidthsTeam = { 30, 150, 150, 50, 50, 50 };
            float[] colWidths = { 30, 50, 150, 150, 50, 50, 50 };
            PdfPTable callingListTbl = null;
            var currentClassNo = 0;
            var multiClasses = TeamPairsManager.GetTeamPairClasses(showId);
            var multiTeams = TeamPairsManager.GetTeamPairsForShow(showId, multiClasses);

            foreach (var showClass in showClasses)
            {
                var grades = showClass.Grades;
                var gradeIdx = 0;

                do
                {
                    if (currentClassNo != showClass.ClassNo)
                    {
                        callingListTbl = TeamPairsManager.isMultiDog(showClass.EntryType) ? new PdfPTable(colWidthsTeam) : new PdfPTable(colWidths);
                        callingListTbl.HeaderRows = 2;
                    }

                    var currentGrade = Convert.ToInt32(showClass.Grades[gradeIdx]) - 48;
                    string tmp;
                    if (showClass.EntryType == 10)
                    {
                        grades = "";
                        tmp = string.Format("Ring {4} - Class {0}: {1} {2} {3}",
                            showClass.ClassNo, showClass.longHeight, showClass.LongClassName,
                            showClass.ClassName, currentRing.RingNo);
                    }
                    else
                    {
                        if (grades.Length == 1)
                        {
                            grades = "Grade " + grades;
                        }
                        else
                        {
                            grades = "Grades " + grades[0] + "-" + grades[grades.Length - 1];
                        }
                        tmp = showClass.Catagory == 0 ?
                            $"Ring {currentRing.RingNo} - Class {showClass.ClassNo}: {showClass.longHeight} Graded {showClass.LongClassName} Grade {currentGrade} {showClass.ClassName}{(showClass.Part > 0 ? " Part " + showClass.Part : "")}"
                            : $"Ring {currentRing.RingNo} - Class {showClass.ClassNo}: {showClass.NormalName(false)} {(showClass.Part > 0 ? " Part " + showClass.Part : "")}";
                    }
                    var cell = new PdfPCell(new Phrase(new Chunk(tmp, bigBoyFont)))
                    {
                        Colspan = 7,
                        BorderWidth = 0
                    };
                    callingListTbl.AddCell(cell);
                    doc.Add(callingListTbl);
                    DrawCourseBoxes(doc);

                    var callingList = showClass.Catagory == 0 ? sc.GetCallingList(showId, showClass.ID, currentGrade) : sc.GetCallingList(showId, showClass.ID);

                    ScoreBoardColumnHeaders(showClass, callingListTbl, callingList, colWidths);

                    if (TeamPairsManager.isMultiDog(showClass.EntryType))
                    {
                        TeamScoreBoard(multiTeams, showClass, callingListTbl);
                    }
                    else
                    {
                        var lhoCurrent = callingList.Any() ? callingList.First().Lho : 0;
                        var lineCnt = 0;
                        foreach (var item in callingList)
                        {

                            if (item.Lho != lhoCurrent)
                            {
                                doc.Add(callingListTbl);
                                doc.NewPage();
                                callingListTbl = new PdfPTable(colWidths);
                                lhoCurrent = item.Lho;

                                ScoreBoardColumnHeaders(showClass, callingListTbl, callingList, colWidths);
                                //var cnt = callingList.Count(x => x.Lho == item.Lho);
                                //var title = $"{(item.Lho == 0 ? "Full Height " : "Lower Height")} ({cnt})";
                                //callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(title, headerHFont)))
                                //{
                                //    BorderWidth = 0,
                                //    Colspan = colWidths.Length,
                                //    BackgroundColor = Color.LIGHT_GRAY,
                                //    HorizontalAlignment = Element.ALIGN_CENTER,
                                //    FixedHeight = 20,
                                //    BorderColorBottom = Color.BLACK,
                                //    BorderWidthBottom = 2
                                //});
                            }

                            var altColor = (lineCnt % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY);
                            cell = new PdfPCell(new Phrase(new Chunk($"{item.Ro}", _normal10Black)))
                            {
                                BorderWidth = 0,
                                FixedHeight = 20f,
                                BackgroundColor = altColor,
                                HorizontalAlignment = Element.ALIGN_RIGHT
                            };
                            callingListTbl.AddCell(cell);

                            int borderWidth = 0;
                            if (showClass.EntryType == 5 || showClass.EntryType == 9) borderWidth = 1;
                            callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk($"{item.RingNumber}", _normal10Black)))
                            {
                                HorizontalAlignment = Element.ALIGN_RIGHT,
                                BackgroundColor = altColor,
                                BorderWidth = borderWidth
                            });

                            var handlerName = item.Name;
                            User user;
                            if (item.DefaultHandlerId > 0)
                            {
                                user = new User(item.DefaultHandlerId);
                                handlerName = user.Name;
                            }
                            if (item.AltHandlerId > 0)
                            {
                                user = new User(item.AltHandlerId);
                                handlerName = user.Name;
                            }

                            cell = new PdfPCell(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(handlerName), _normal10Black)))
                            {
                                BackgroundColor = altColor,
                                BorderWidth = borderWidth
                            };
                            callingListTbl.AddCell(cell);

                            cell =
                                new PdfPCell(
                                    new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(item.KcName), _normal10Black)))
                                {
                                    BackgroundColor = altColor,
                                    BorderWidth = borderWidth
                                };
                            callingListTbl.AddCell(cell);

                            cell = new PdfPCell(new Phrase(""));
                            cell.BorderWidth = 1;
                            if (showClass.EntryType == 4)
                            {
                                cell.BorderWidthBottom = 0;
                            }
                            callingListTbl.AddCell(cell);
                            cell = new PdfPCell(new Phrase(""));
                            cell.BackgroundColor = Color.WHITE;
                            cell.BorderWidth = 1;
                            if (showClass.EntryType == 4)
                            {
                                cell.BorderWidthBottom = 0;
                            }
                            callingListTbl.AddCell(cell);
                            callingListTbl.AddCell(cell);
                            lineCnt++;
                        }
                        cell = new PdfPCell(new Phrase(""));
                        cell.BorderWidth = 0;
                        cell.Colspan = 7;
                        cell.FixedHeight = 50f;
                        callingListTbl.AddCell(cell);
                    }

                    doc.Add(callingListTbl);
                    gradeIdx++;

                } while (showClass.Catagory == 0 && gradeIdx < showClass.Grades.Length);
                doc.NewPage();
            }

            return ret;
        }
        public void ScribeSheets(Document doc, int showId, int ringId, PdfWriter writer )
        {
            var font = new Font(Font.HELVETICA, 10, Font.NORMAL, Color.BLACK);
            var smallFont = new Font(Font.HELVETICA, 8, Font.NORMAL, Color.BLACK);
            var totalsFont = new Font(Font.HELVETICA, 14, Font.BOLD, Color.BLACK);
            var bigBoyFont = new Font(Font.HELVETICA, 20, Font.BOLD, Color.BLACK);
            var bigBoyFont2 = new Font(Font.HELVETICA, 25, Font.BOLD, Color.BLACK);
            var blankCell = new PdfPCell(new Phrase(new Chunk("", font)));
            var sc = new ShowClasses();
            var currentRing = new Rings(ringId);
            var multiClasses = TeamPairsManager.GetTeamPairClasses(showId);
            var multiTeams = TeamPairsManager.GetTeamPairsForShow(showId, multiClasses);
            var showClasses = ShowClasses.GetAllClassesForShowRing(showId, ringId);
            foreach (var showClass in showClasses)
            {
                var callingList = sc.GetCallingList(showId, showClass.ID);

                var grades = showClass.Grades;
                if (grades.Length == 1)
                {
                    grades = "Grade " + grades;
                }
                else
                {
                    grades = "Grades " + grades[0] + "-" + grades[grades.Length - 1];
                }
                var ptable = new PdfPTable(1);
                var tmp = $"Class {showClass.ClassNo}";
                var cell = new PdfPCell(new Phrase(new Chunk(tmp, bigBoyFont2)))
                {
                    BorderWidth = 0,
                    Padding = 5,
                    HorizontalAlignment = Element.ALIGN_MIDDLE,
                    VerticalAlignment = Element.ALIGN_CENTER
                };
                ptable.AddCell(cell);

                if (showClass.EntryType == 10)
                {
                    tmp = $"{showClass.longHeight} {showClass.LongClassName} {showClass.ClassName}";
                }
                else
                {
                    tmp =
                        $"{showClass.NormalName(withClassNo: false)} {(showClass.Part > 0 ? "Part " + showClass.Part : "")} ";
                }
                cell = new PdfPCell(new Phrase(new Chunk(tmp, totalsFont)))
                {
                    BorderWidth = 0,
                    Padding = 5,
                    HorizontalAlignment = Element.ALIGN_MIDDLE,
                    VerticalAlignment = Element.ALIGN_CENTER
                };
                ptable.AddCell(cell);

                if (showClass.EntryType != 10)
                {
                    tmp = $"{grades}";
                    cell = new PdfPCell(new Phrase(new Chunk(tmp, totalsFont)))
                    {
                        BorderWidth = 0,
                        Padding = 5,
                        FixedHeight = 100f,
                        HorizontalAlignment = Element.ALIGN_MIDDLE,
                        VerticalAlignment = Element.ALIGN_CENTER
                    };
                    ptable.AddCell(cell);
                }

                tmp = $"Ring {currentRing.RingNo}";
                cell = new PdfPCell(new Phrase(new Chunk(tmp, totalsFont)))
                {
                    BorderWidth = 0,
                    Padding = 5,
                    FixedHeight = 30f,
                    HorizontalAlignment = Element.ALIGN_MIDDLE
                };
                ptable.AddCell(cell);

                tmp = $"Ring Order = {showClass.Position}";
                cell = new PdfPCell(new Phrase(new Chunk(tmp, totalsFont)))
                {
                    BorderWidth = 0,
                    Padding = 5,
                    FixedHeight = 30f,
                    HorizontalAlignment = Element.ALIGN_MIDDLE
                };
                ptable.AddCell(cell);

                doc.Add(ptable);
                doc.NewPage();

                if (TeamPairsManager.isMultiDog(showClass.EntryType))
                {
                    float[] colWidths = { 300, 150 };
                    var callingListTbl = new PdfPTable(colWidths);

                    var teamsForClass = multiTeams.Where(t => t.ClassId == showClass.ID).OrderBy(t => t.RO);
                    foreach (var team in teamsForClass)
                    {

                        tmp = $"Class {showClass.NormalName()}: {(showClass.Part > 0 ? "Part " + showClass.Part : "")}";
                        cell = new PdfPCell(new Phrase(new Chunk(tmp, notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            PaddingTop = 1,
                            PaddingLeft = 2,
                            FixedHeight = 50f
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(new Phrase(new Chunk(team.RO.ToString(), bigBoyFont)))
                        {
                            BorderWidth = 2,
                            BorderColorLeft = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            HorizontalAlignment = Element.ALIGN_CENTER,
                            Padding = 5
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(new Phrase(new Chunk("Course Time", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            Padding = 5,
                            BorderColorRight = Color.BLACK,
                            HorizontalAlignment = Element.ALIGN_RIGHT
                        };
                        callingListTbl.AddCell(cell);
                        cell = new PdfPCell(new Phrase(new Chunk(" ", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            Padding = 5,
                            BorderColorRight = Color.BLACK,
                            HorizontalAlignment = Element.ALIGN_RIGHT
                        };
                        callingListTbl.AddCell(cell);

                        if (TeamPairsManager.isTeam(showClass.EntryType))
                        {
                            cell =
                                new PdfPCell(
                                    new Phrase(new Chunk(team.TeamDetails.TeamName.Replace("&#39;", "'"), bold12)))
                                {
                                    PaddingBottom = 5,
                                    BorderWidth = 0,
                                    BorderWidthBottom = 1,
                                    HorizontalAlignment = Element.ALIGN_CENTER,
                                    BorderColor = Color.LIGHT_GRAY,
                                    Colspan = 2
                                };
                            callingListTbl.AddCell(cell);
                            var dogCnt = 0;
                            var reserves = "";
                            foreach (var md in team.Members)
                            {
                                if (dogCnt < team.DogCount)
                                {
                                    cell = new PdfPCell(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.DogName), normal8)));
                                    cell.BorderWidth = 0;
                                    callingListTbl.AddCell(cell);

                                    cell = new PdfPCell(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.HandlerName), normal8)));
                                    cell.BorderWidth = 0;
                                    cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                                    callingListTbl.AddCell(cell);
                                }
                                else
                                {
                                    if (md.HandlerName.Length > 0  )
                                    {
                                        if (reserves.Length > 0) reserves += ",";
                                        reserves +=
                                            $"{Utils.TitleCaseString(md.HandlerName)} & {Utils.TitleCaseString(md.DogName)}";
                                    }
                                }
                                dogCnt++;
                            }
                            if (reserves.Length > 0)
                            {
                                cell = new PdfPCell(new Phrase(new Chunk("Reserves:" + reserves, italic8)))
                                {
                                    BorderWidth = 0,
                                    Colspan = 2
                                };
                                callingListTbl.AddCell(cell);
                            }
                            doc.Add(callingListTbl);

                            callingListTbl = new PdfPTable(colWidths);
                            var linecnt = writer.GetVerticalPosition(false) - doc.BottomMargin;
                            cell = new PdfPCell
                            {
                                BorderWidth = 0,
                                Colspan = 2,
                                FixedHeight = writer.PageSize.Height - linecnt - 60
                            };
                            callingListTbl.AddCell(cell);
                            doc.Add(callingListTbl);

                        }
                        else
                        {
                            var memberTable = new PdfPTable(new float[] { 300, 300 });
                            var memberCell = new PdfPCell(memberTable)
                            {
                                BorderWidth = 0,
                                Colspan = 2,
                                PaddingBottom = 10
                            };
                            var dogCnt = 0;
                            foreach (var md in team.Members)
                            {
                                if (dogCnt < team.DogCount)
                                {
                                    cell =
                                        new PdfPCell(
                                            new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.HandlerName), font)))
                                        {
                                            BorderWidth = 0
                                        };
                                    memberTable.AddCell(cell);

                                    cell =
                                        new PdfPCell(
                                            new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.DogName), font)))
                                        {
                                            BorderWidth = 0
                                        };
                                    memberTable.AddCell(cell);
                                }
                                dogCnt++;
                            }
                            memberCell.FixedHeight = 180f;
                            callingListTbl.AddCell(memberCell);
                            doc.Add(callingListTbl);
                        }

                        callingListTbl = new PdfPTable(colWidths);
                        cell = new PdfPCell(new Phrase(new Chunk("Time", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);

                        cell = new PdfPCell(new Phrase(new Chunk("Course Faults", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);

                        cell = new PdfPCell(new Phrase(new Chunk("Time Faults", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);

                        cell = new PdfPCell(new Phrase(new Chunk("Totals Faults", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);
                        doc.Add(callingListTbl);
                        doc.NewPage();

                        doc.NewPage();
                        callingListTbl = new PdfPTable(colWidths);

                    }
                    doc.Add(callingListTbl);

                }
                else {
                    foreach (var item in callingList)
                    {
                        if (item.Category == 0 && showClass.EntryType != 10)
                        {
                            var tbl = new PdfPTable(1);
                            tmp = item.Grade == 99 ? "Veteran" : $"Grade {item.Grade}";
                            cell = new PdfPCell(new Phrase(new Chunk(tmp, bigBoyFont2)))
                            {
                                BackgroundColor = Color.LIGHT_GRAY,
                                BorderWidth = 2,
                                Padding = 9,
                                PaddingTop = 4,
                                HorizontalAlignment = Element.ALIGN_RIGHT
                            };
                            tbl.AddCell(cell);
                            doc.Add(tbl);
                        }

                        float[] colWidths = { 300, 150 };
                        var callingListTbl = new PdfPTable(colWidths);
                        tmp = showClass.EntryType == 10 ?
                            $"Class {showClass.ClassNo}: {showClass.longHeight} {showClass.LongClassName} {showClass.ClassName}"
                            : $"Class {showClass.ClassNo}: {showClass.NormalName(withClassNo: false)} {(showClass.Part > 0 ? "Part " + showClass.Part : "")}";
                        cell = new PdfPCell(new Phrase(new Chunk(tmp, notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            PaddingTop = 1,
                            PaddingLeft = 2,
                            FixedHeight = 50f
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(new Phrase(new Chunk($"{item.Ro}", bigBoyFont)))
                        {
                            BorderWidth = 2,
                            BorderColorLeft = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            HorizontalAlignment = Element.ALIGN_CENTER,
                            Padding = 5
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(new Phrase(new Chunk("Course Time", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            Padding = 5,
                            BorderColorRight = Color.BLACK,
                            HorizontalAlignment = Element.ALIGN_RIGHT
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(new Phrase(new Chunk("", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            Padding = 5,
                            BorderColorBottom = Color.BLACK
                        };
                        callingListTbl.AddCell(cell);

                        var handlerName = item.Name;
                        User user;
                        if (item.DefaultHandlerId > 0)
                        {
                            user = new User(item.DefaultHandlerId);
                            handlerName = user.Name;
                        }
                        if (item.AltHandlerId> 0)
                        {
                            user = new User(item.AltHandlerId);
                            handlerName = user.Name;
                        }

                        if (showClass.EntryType == 5 || showClass.EntryType == 9)
                        {
                            cell =
                                new PdfPCell(new Phrase(new Chunk($"{Utils.TitleCaseString(handlerName)}", smallFont)))
                                {
                                    BorderWidth = 0,
                                    Colspan = 1,
                                    HorizontalAlignment = Element.ALIGN_LEFT
                                };
                            callingListTbl.AddCell(cell);

                            cell = new PdfPCell(new Phrase(new Chunk(
                                $"{Utils.TitleCaseString(item.KcName),-10}", smallFont)))
                            {
                                Colspan = 1,
                                HorizontalAlignment = Element.ALIGN_RIGHT,
                                BorderWidth = 0
                            };
                        }
                        else
                        {
                            cell =
                                new PdfPCell(new Phrase(new Chunk($"{Utils.TitleCaseString(handlerName)}", notSoBigFont)))
                                {
                                    BorderWidth = 0,
                                    Colspan = 2
                                };
                            callingListTbl.AddCell(cell);
                            callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(
                                $"{item.RingNumber,-10} {Utils.TitleCaseString(item.KcName)}",
                                notSoBigFont)))
                            {
                                BorderWidth = 0,
                                Colspan = 2
                            });

                            callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk($"{item.Breed}", notSoBigFontItalic))) { BorderWidth = 0, Colspan = 2});

                            cell = new PdfPCell(new Phrase(new Chunk($"{(item.Lho == 0 ? "" : "Lower Height")}", Bold18Black)))
                            {
                                BorderWidth = 0,
                                Colspan = 2,
                                PaddingTop = 10
                            };
                        }

                        int[] extendHeight = { 1, 2, 3, 7, 10, 11 };
                        if (extendHeight.Any(h => h == showClass.EntryType))
                        {
                            cell.FixedHeight = 160f;
                        }
                        cell.Colspan = 2;
                        callingListTbl.AddCell(cell);

                        doc.Add(callingListTbl);
                        callingListTbl = new PdfPTable(colWidths);
                        cell = new PdfPCell(new Phrase(new Chunk("Time", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);

                        cell = new PdfPCell(new Phrase(new Chunk("Course Faults", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);

                        cell = new PdfPCell(new Phrase(new Chunk("Time Faults", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);

                        cell = new PdfPCell(new Phrase(new Chunk("Totals Faults", notSoBigFont)))
                        {
                            BorderWidth = 2,
                            BorderColorRight = Color.BLACK,
                            BorderColorBottom = Color.BLACK,
                            Padding = 5,
                            HorizontalAlignment = Element.ALIGN_CENTER
                        };
                        callingListTbl.AddCell(cell);
                        callingListTbl.AddCell(blankCell);
                        doc.Add(callingListTbl);
                        doc.NewPage();

                    }
                }
            }
        }