public override MedalProgress GetProgress(SpontaneousUserModel statistic)
        {
            if (!IfAlreadyHave(statistic))
            {
                MedalProgress returnValue = new MedalProgress()
                {
                    MedalType = MedalType,
                    totalPointsRequired = 0,
                    pointsRequired = 0
                };
                //Calculate total points required for the medal
                foreach (var requirement in RequirementsList)
                {
                    returnValue.totalPointsRequired += requirement.Activity.Points * requirement.Count;
                }

                returnValue.pointsRequired = returnValue.totalPointsRequired;

                if (statistic != null && statistic.UserActivityList != null)
                {
                    //Calculate points still required for the medal
                    foreach (var userActivity in statistic.UserActivityList)
                    {
                        if (userActivity is AddRestaurantActivity)
                        {
                            returnValue.pointsRequired = returnValue.totalPointsRequired - statistic.GetActivityCount(userActivity.GetType().Name) * userActivity.Points;
                        }
                    }
                    if (returnValue.pointsRequired < 0) returnValue.pointsRequired = 0;
                }
                return returnValue;
            }
            return null;
        }
        public override MedalProgress GetProgress(SpontaneousUserModel statistic)
        {
            //if (!IfAlreadyHave(statistic))
            //{
                UserMedal currentMedal = new RestaurantAdviserMedal();
                currentMedal.CreatedAt = new DateTime(0);
                if (statistic.UserMedalsList != null && statistic.UserMedalsList.Count > 0)
                {
                    currentMedal = getLastMedal(statistic);
                }

                MedalProgress returnValue = new MedalProgress()
                {
                    MedalType = MedalType,
                };
                //Calculate total points required for the medal
                foreach (var requirement in RequirementsList)
                {
                    returnValue.totalPointsRequired += requirement.Activity.Points * requirement.Count;
                }

                returnValue.pointsRequired = returnValue.totalPointsRequired;

                if (statistic != null && statistic.UserActivityList != null)
                {
                    //Calculate points still required for the medal
                    bool inviteFriendActivityFlag = false;
                    foreach (UserActivity userActivity in statistic.UserActivityList)
                    {
                        if (userActivity.Date > currentMedal.CreatedAt)
                        {
                            if (userActivity is InviteFriendActivity)
                            {
                                if (!inviteFriendActivityFlag)
                                {
                                    returnValue.pointsRequired =
                                        returnValue.pointsRequired -= userActivity.Points;
                                    inviteFriendActivityFlag = true;
                                }
                            }
                        }//if (userActivity.Date > currentMedal.CreatedAt)
                    }
                    if (returnValue.pointsRequired < 0) returnValue.pointsRequired = 0;
                }
                return returnValue;
            //}
            //return null;
        }
        public override MedalProgress GetProgress(SpontaneousUserModel statistic)
        {
            if (!IfAlreadyHave(statistic))
            {
                MedalProgress returnValue = new MedalProgress()
                {
                    MedalType = MedalType,
                    totalPointsRequired = 0,
                    pointsRequired = 0
                };
                //Calculate total points required for the medal
                foreach (var requirement in RequirementsList)
                {
                    returnValue.totalPointsRequired += requirement.Activity.Points * requirement.Count;
                }

                returnValue.pointsRequired = returnValue.totalPointsRequired;

                if (statistic != null && statistic.UserActivityList != null)
                {
                    //Calculate points still required for the medal
                    bool PageViewActivityFlag = false;
                    foreach (UserActivity userActivity in statistic.UserActivityList)
                    {
                        if (userActivity is PageViewActivity)
                        {
                            if (!PageViewActivityFlag)
                            {
                                returnValue.pointsRequired -= userActivity.Points;
                                PageViewActivityFlag = true;
                            }
                        }
                    }
                    // if points grater then required
                    if (returnValue.pointsRequired < 0) returnValue.pointsRequired = 0;
                }
                return returnValue;
            }
            return null;
        }
        public override MedalProgress GetProgress(SpontaneousUserModel statistic)
        {
            //if (!IfAlreadyHave(statistic))
            //{
                UserMedal currentMedal = new FlowCompleteMedal();
                currentMedal.CreatedAt = new DateTime(0);
                if (statistic.UserMedalsList != null && statistic.UserMedalsList.Count > 0)
                {
                    currentMedal = getLastMedal(statistic);
                }

                MedalProgress returnValue = new MedalProgress()
                {
                    MedalType = MedalType,
                };
                //Calculate total points required for the medal
                foreach (var requirement in RequirementsList)
                {
                    returnValue.totalPointsRequired += requirement.Activity.Points * requirement.Count;
                }

                returnValue.pointsRequired = returnValue.totalPointsRequired;

                if (statistic != null && statistic.UserActivityList != null)
                {
                    //Calculate points still required for the medal
                    bool RestaurantMenuEnterActivityFlag = false;
                    bool MenuLinkPushActivityFlag = false;
                    bool ApproveMealPushActivityFlag = false;
                    bool SendMealSummaryActivityFlag = false;
                    bool PreMealSugarApproveActivityFlag = false;
                    bool PostMealSugarApproveActivityFlag = false;
                    bool PostMealCarbBlameActivityFlag = false;
                    foreach (UserActivity userActivity in statistic.UserActivityList)
                    {
                        if (userActivity.Date > currentMedal.CreatedAt)
                        {
                            SpontaneousMedalRequirementChecker.ActivityType type =
                                (SpontaneousMedalRequirementChecker.ActivityType)System.Enum.Parse(typeof(SpontaneousMedalRequirementChecker.ActivityType), userActivity.GetType().Name);
                            //int activityType = (int)type;
                            var dateDiff = (DateTime.UtcNow - userActivity.Date).TotalDays;

                            switch (type)
                            {
                                case SpontaneousMedalRequirementChecker.ActivityType.PageViewActivity:
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.RestaurantMenuEnterActivity:
                                    if (!RestaurantMenuEnterActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired =
                                            returnValue.pointsRequired -= userActivity.Points;
                                        RestaurantMenuEnterActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.MenuLinkPushActivity:
                                    if (!MenuLinkPushActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired -= userActivity.Points;
                                        MenuLinkPushActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.ApproveMealPushActivity:
                                    if (!ApproveMealPushActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired -= userActivity.Points;
                                        ApproveMealPushActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.SendMealSummaryActivity:
                                    if (!SendMealSummaryActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired -= userActivity.Points;
                                        SendMealSummaryActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.PreMealSugarApproveActivity:
                                    if (!PreMealSugarApproveActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired -= userActivity.Points;
                                        PreMealSugarApproveActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.PostMealSugarApproveActivity:
                                    if (!PostMealSugarApproveActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired -= userActivity.Points;
                                        PostMealSugarApproveActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.PostMealCarbBlameActivity:
                                    if (!PostMealCarbBlameActivityFlag && dateDiff < 1)
                                    {
                                        returnValue.pointsRequired -= userActivity.Points;
                                        PostMealCarbBlameActivityFlag = true;
                                    }
                                    break;
                                case SpontaneousMedalRequirementChecker.ActivityType.MedalViewActivity:
                                    break;
                                default:
                                    break;
                            }

                        }//if (userActivity.Date > currentMedal.CreatedAt)
                    }
                    if (returnValue.pointsRequired < 0) returnValue.pointsRequired = 0;
                }
                return returnValue;
            //}
            //return null;
        }