private async Task UpdateMinutesAsync(StatisticsType common, StatisticsParams newValues, StatisticsParams oldValues)
        {
            if (oldValues == null)
            {
                oldValues = new StatisticsParams();
            }

            var minutes = Math.Max(newValues.Minutes - oldValues.Minutes, 0);

            await UpdateAsync(common, minutes, newValues.Team);
        }
        private async Task UpdateCardsAsync(StatisticsParams newValues, StatisticsParams oldValues)
        {
            if (oldValues == null)
            {
                oldValues = new StatisticsParams();
            }

            var redCards    = Math.Max(newValues.RedCards - oldValues.RedCards, 0);
            var yellowCards = Math.Max(newValues.YellowCards - oldValues.YellowCards, 0);
            var team        = newValues.Team;

            await this.UpdateAsync(StatisticsType.RedCardsByTeam, redCards, team);

            await this.UpdateAsync(StatisticsType.YellowCardsByTeam, yellowCards, team);
        }
        private void CreateParams <T>(T newValues,
                                      T oldValues,
                                      out StatisticsParams stNewValues,
                                      out StatisticsParams stOldValues) where T : class
        {
            stNewValues = new StatisticsParams();
            stOldValues = new StatisticsParams();

            switch (newValues)
            {
            case Manager m:
                stNewValues = CreateStatisticsParams(m);
                if (oldValues != null)
                {
                    stOldValues = CreateStatisticsParams(oldValues as Manager);
                }

                break;

            case Player p:
                stNewValues = CreateStatisticsParams(p);
                if (oldValues != null)
                {
                    stOldValues = CreateStatisticsParams(oldValues as Player);
                }

                break;

            case Referee r:
                stNewValues = CreateStatisticsParams(r);
                if (oldValues != null)
                {
                    stOldValues = CreateStatisticsParams(oldValues as Referee);
                }

                break;

            default:
                throw new Exception("Canno't convert the type of statistic");
            }
        }