private static string GenerateSummaryForInstance(VF_RDDatabase.PlayerSummary _PlayerSummary, PlayerData _Player, string _Instance, VF_RealmPlayersDatabase.WowRealm _Realm, string _GuildLimit = null)
        {
            string realmStr = RealmPlayersServer.StaticValues.ConvertRealmParam(_Realm);

            System.Text.StringBuilder page = new System.Text.StringBuilder("");

            int bossesData = 0;

            foreach (var boss in BossInformation.BossesInInstanceNoOptional[_Instance])
            {
                if (_PlayerSummary.PlayerBossStats.ContainsKey(boss) == false)
                {
                    continue;
                }

                if (bossesData == 0)
                {
                    page.Append("<table class='table'><thead><tr><th>Boss</th><th>DPS #Rank</th><th>HPS #Rank</th><th>Average DPS</th><th>Average HPS</th><th>Top DPS</th><th>Top HPS</th><th>Kill Count</th></thead><tbody>");
                }
                ++bossesData;

                List <VF_RDDatabase.PlayerFightData> dpsSamplesUsed = null;
                List <VF_RDDatabase.PlayerFightData> hpsSamplesUsed = null;

                var playerBossData = _PlayerSummary.PlayerBossStats[boss];
                if (playerBossData.m_PlayerFightDatas.Count < 3 || (_Instance != "Molten Core" && playerBossData.m_PlayerFightDatas.Count < 4))
                {
                    return("");
                }
                playerBossData.GetAverageDPS(5, 6, 3, out dpsSamplesUsed);
                playerBossData.GetAverageEffectiveHPS(5, 6, 3, out hpsSamplesUsed);

                float bwlBossDPS          = 0.0f;
                float bwlBossHPS          = 0.0f;
                var   bwlBossDataSet      = AverageOverview.GenerateAverageDataSet(boss, null, null, _Realm, _GuildLimit);
                var   bwlBossDPSRank      = GetDPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossDPS);
                var   bwlBossDPSRankClass = GetDPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossDPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); });
                var   bwlBossHPSRank      = GetHPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossHPS);
                var   bwlBossHPSRankClass = GetHPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossHPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); });
                //page += "<h5>" + boss + "</h5>";
                //page += "DPS Rank: #" + bwlBossDPSRank + " with DPS " + bwlBossDPS.ToStringDot("0.0");

                string dpsSamplesStr = "";

                if (dpsSamplesUsed.Count > 0)
                {
                    dpsSamplesStr = " (";

                    for (int i = 0; i < dpsSamplesUsed.Count; ++i)
                    {
                        dpsSamplesStr += PageUtility.CreateLink_FightOverview(dpsSamplesUsed[i].CacheBossFight, dpsSamplesUsed[i].DPS.ToStringDot("0.0")) + ", ";
                    }
                    dpsSamplesStr  = dpsSamplesStr.Substring(0, dpsSamplesStr.Length - 2);
                    dpsSamplesStr += ")";
                }

                string hpsSamplesStr = "";
                if (hpsSamplesUsed.Count > 0)
                {
                    hpsSamplesStr = " (";

                    for (int i = 0; i < hpsSamplesUsed.Count; ++i)
                    {
                        hpsSamplesStr += PageUtility.CreateLink_FightOverview(hpsSamplesUsed[i].CacheBossFight, hpsSamplesUsed[i].EffectiveHPS.ToStringDot("0.0")) + ", ";
                    }
                    hpsSamplesStr  = hpsSamplesStr.Substring(0, hpsSamplesStr.Length - 2);
                    hpsSamplesStr += ")";
                }

                page.Append("<tr>");
                page.Append("<td>" + boss + "</td>");
                if (bwlBossDPS != 0.0f || bwlBossHPS != 0.0f)
                {
                    page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlBossDPSRank, RPColor.Red)) + " / ");
                    page.Append(PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class), PageUtility.CreateColorString("#" + bwlBossDPSRankClass, _Player.Character.Class)) + "</td>");
                    page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlBossHPSRank, RPColor.Green)) + " / ");
                    page.Append(PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class), PageUtility.CreateColorString("#" + bwlBossHPSRankClass, _Player.Character.Class)) + "</td>");
                }
                else
                {
                    page.Append("<td>#??(inactive)</td>");
                    page.Append("<td>#??(inactive)</td>");
                }
                page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString(bwlBossDPS.ToStringDot("0.0"), RPColor.Red))
                            + dpsSamplesStr
                            + "</td>");
                page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString(bwlBossHPS.ToStringDot("0.0"), RPColor.Green))
                            + hpsSamplesStr
                            + "</td>");
                page.Append("<td>" + PageUtility.CreateLink("FightOverallOverview.aspx?FightName=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, "view") + "</td>");
                page.Append("<td>" + PageUtility.CreateLink("FightOverallOverview.aspx?FightName=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, "view") + "</td>");
                page.Append("<td>" + _PlayerSummary.AttendedFights.Count((_Value) => _Value.BossName == boss) + "</td>");
                page.Append("</tr>");
            }
            if (bossesData == 0)
            {
                return("");
            }
            else if (bossesData > 0)
            {
                page.Append("</tbody></table>");
            }

            string averagePageData = "<p><h3>Active Ranking in " + _Instance + "</h3>";

            {
                var bwlDataSet = AverageOverview.GenerateAverageDataSet(_Instance, null, null, _Realm, _GuildLimit);

                float  bwlDPS          = 0.0f;
                string bwlDPSRank      = GetDPSRank(bwlDataSet, _PlayerSummary.Name, out bwlDPS).ToString();
                string bwlDPSRankClass = GetDPSRank(bwlDataSet, _PlayerSummary.Name, out bwlDPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); }).ToString();


                float  bwlHPS          = 0.0f;
                string bwlHPSRank      = GetHPSRank(bwlDataSet, _PlayerSummary.Name, out bwlHPS).ToString();
                string bwlHPSRankClass = GetHPSRank(bwlDataSet, _PlayerSummary.Name, out bwlHPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); }).ToString();

                if (bwlDPS != 0.0f || bwlHPS != 0.0f)
                {
                    string bossIdentifierStr = BossesControl.MC_ALL;
                    if (_Instance == "Molten Core")
                    {
                        bossIdentifierStr = BossesControl.MC_ALL;
                    }
                    else if (_Instance == "Blackwing Lair")
                    {
                        bossIdentifierStr = BossesControl.BWL_ALL;
                    }
                    else if (_Instance == "Ahn'Qiraj Temple")
                    {
                        bossIdentifierStr = BossesControl.AQ40_ALL;
                    }
                    else if (_Instance == "Naxxramas - All Quarters")
                    {
                        bossIdentifierStr = BossesControl.NAXX_ALL_QUARTERS;
                    }

                    bwlDPSRank = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlDPSRank, RPColor.Red));
                    bwlHPSRank = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlHPSRank, RPColor.Green));

                    bwlDPSRankClass = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class)
                                                             , PageUtility.CreateColorString("#" + bwlDPSRankClass, _Player.Character.Class));
                    bwlHPSRankClass = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class)
                                                             , PageUtility.CreateColorString("#" + bwlHPSRankClass, _Player.Character.Class));


                    averagePageData += "<h5>DPS Rank: " + bwlDPSRank + " / " + bwlDPSRankClass + " with DPS " + bwlDPS.ToStringDot("0.0") + "</h5>";
                    averagePageData += "<h5>HPS Rank: " + bwlHPSRank + " / " + bwlHPSRankClass + " with HPS " + bwlHPS.ToStringDot("0.0") + "</h5>";
                }
                else
                {
                    averagePageData += "<h5>DPS Rank: #??(inactive)</h5>";
                    averagePageData += "<h5>HPS Rank: #??(inactive)</h5>";
                }
            }

            return(averagePageData + page.ToString());
        }