/// <summary>
        /// check if match beetwen woman and man is possible. the check is not include with other booleans (weight, belt etc...)
        /// </summary>
        /// <param name="HigherGraded">the man contender</param>
        /// <param name="LowerGraded">the woman contender</param>
        /// <param name="CheckAndUpgradeContender"></param>
        /// <returns></returns>
        private int WomanMatchToManChecking(ContenderLeague HigherGraded, ContenderLeague LowerGraded, bool CheckAndUpgradeContender = false)
        {
            // match only woman to man
            if (LowerGraded.Contender.IsMale == false && HigherGraded.Contender.IsMale == true)
            {
                if (HigherGraded.Contender.Grade == LowerGraded.Contender.Grade + 0.5)
                {
                    // check if lower contender is allowed to have one rank of weight above and if the grades are equal its a match
                    if (LowerGraded.Contender.IsAllowedVersusMan == true)
                    {
                        if (CheckAndUpgradeContender == true) // upgrade contender if needed
                        {
                            LowerGraded.Factor += 0.5;
                        }
                        // match succided
                        return(HigherGraded.Contender.SystemID);
                    }
                }
                // no match
                return(0);
            }

            else
            {
                return(0);
            }
        }
        /// <summary>
        /// AGAINST REAL GRADE!
        /// check if match is possible beetween higher and lower graded contenders. the priorities is weight than belt and then both of them.
        /// </summary>
        /// <param name="frequencyValue"></param>
        /// <param name="stepUp"></param>
        /// <param name="stepDown"></param>
        private int AdultsMatchCheckingAgainstHigherRealGrade(ContenderLeague HigherGraded, ContenderLeague LowerGraded, bool CheckAndUpgradeContender = false)
        {
            // check if weight is only 1 rank of category above
            if (HigherGraded.Contender.WeightCategory - LowerGraded.Contender.WeightCategory == 1)
            {
                // check if lower contender is allowed to have one rank of weight above and if the grades are equal its a match
                if (LowerGraded.Contender.WeightFactor + LowerGraded.Contender.Grade == HigherGraded.Grade)
                {
                    if (CheckAndUpgradeContender == true) // upgrade contender if needed
                    {
                        LowerGraded.Factor += 1;
                    }
                    // match succided
                    return(HigherGraded.Contender.SystemID);
                }
            }

            // check if belt is only 1 rank of category above
            if (HigherGraded.Contender.Belt - LowerGraded.Contender.Belt == 1000)
            {
                // check if lower contender is allowed to have one rank of belt above and if the grades are equal its a match
                if (LowerGraded.Contender.BeltFactor + LowerGraded.Contender.Grade == HigherGraded.Grade)
                {
                    if (CheckAndUpgradeContender == true) // upgrade contender if needed
                    {
                        LowerGraded.Factor += 1000;
                    }
                    // match succided
                    return(HigherGraded.Contender.SystemID);
                }
            }

            // check if the 2 condition above can make a match
            if (HigherGraded.Contender.Belt - LowerGraded.Contender.Belt == 1000 && HigherGraded.Contender.WeightCategory - LowerGraded.Contender.WeightCategory == 1)
            {
                if (LowerGraded.Contender.BeltFactor + LowerGraded.Contender.WeightFactor + LowerGraded.Contender.Grade == HigherGraded.Grade)
                {
                    if (CheckAndUpgradeContender == true) // upgrade contender if needed
                    {
                        LowerGraded.Factor += 1001;
                    }
                    // match succided
                    return(HigherGraded.Contender.SystemID);
                }
            }

            // if LowerGraded is woman and HigherGraded is man try to upgrade the woman to mans bracket
            if (LowerGraded.Contender.IsMale == false && HigherGraded.Contender.IsMale == true)
            {
                return(WomanMatchToManChecking(HigherGraded, LowerGraded, CheckAndUpgradeContender));
            }

            // no match
            return(0);
        }
        /// <summary>
        /// this function will try to find a match for a specific contender (not a group)
        /// </summary>
        /// <param name="LowerCont"></param>
        private void TryUpgradeLowerCont(ContenderLeague LowerCont)
        {
            var p = ContendersLeagueList.AsEnumerable().Where(x => x.FinalGrade <= LowerCont.Contender.Grade + 1000 + 50 + 1 && x.FinalGrade > LowerCont.Contender.Grade && x.FrequencyOfGrade >= LowerCont.FrequencyOfGrade).Select(x => x).ToList();

            foreach (ContenderLeague clHigh in p)
            {
                if (MatchCheckingAgainstHigher_FinalGrade(clHigh, LowerCont, true) > 0)
                {
                    // refresh the ScatteringObj statistics
                    RefreshData();
                    RefreshThisInstanceStatistics();
                    break;
                }
            }
        }
        private int MatchCheckingAgainstHigher_RealGrade(ContenderLeague HigherGraded, ContenderLeague LowerGraded, bool CheckAndUpgradeContender = false)
        {
            // to prevent double upgrading, if in the dirst time the contender was upgraded so factor must be set to 0 to prevent adding false data
            if (LowerGraded.Factor > 0)
            {
                LowerGraded.Factor = 0;
            }

            if (LowerGraded.Contender.IsChild)
            {
                return(ChildsMatchCheckingAgainstHigherRealGrade(HigherGraded, LowerGraded, CheckAndUpgradeContender));
            }
            else
            {
                return(AdultsMatchCheckingAgainstHigherRealGrade(HigherGraded, LowerGraded, CheckAndUpgradeContender));
            }
        }
        /// <summary>
        /// find the best match beetwen group of contenders to a a specipic contender
        /// </summary>
        /// <param name="group"></param>
        /// <param name="contender"></param>
        /// <returns>the best match from the List</returns>
        private ContenderLeague GetWeightApproximationMatch(List <ContenderLeague> group, ContenderLeague contender)
        {
            var cont = group[0];

            for (int i = 1; i < group.Count; i++)
            {
                double a = cont.Contender.Weight - contender.Contender.Weight;
                double b = group[i].Contender.Weight - contender.Contender.Weight;

                if (Math.Abs(b) < Math.Abs(a))
                {
                    cont = group[i];
                }
            }

            return(cont);
        }