private async Task UpdateGranularity()
        {
            var phase = YobotApiSource.Default.PhaseList.Last();
            var acceptGranularities = _statsVm.SourceStatsFunction.AcceptGranularities;

            if (acceptGranularities.Contains(GranularityType.Total))
            {
                DateAdjust.Visibility     = Visibility.Collapsed;
                RoundAdjust.Visibility    = Visibility.Collapsed;
                _statsVm.GranularityModel = new GranularityModel(phase);
            }
            else
            {
                if (!acceptGranularities.Contains(GranularityType.SingleDate) &&
                    !acceptGranularities.Contains(GranularityType.MultiDate))
                {
                    DateAdjust.Visibility = Visibility.Collapsed;
                }
                else
                {
                    var startDate = (DateTime?)CbStartDate.SelectedItem;
                    var endDate   = (DateTime?)CbEndDate.SelectedItem;
                    if (!acceptGranularities.Contains(GranularityType.SingleDate))
                    {
                        _statsVm.GranularityModel = new GranularityModel
                        {
                            GranularityType = GranularityType.MultiDate,
                            StartDate       = startDate == DateTime.MinValue ? null : startDate,
                            EndDate         = endDate == DateTime.MinValue ? null : endDate
                        };
                    }
                    else if (!acceptGranularities.Contains(GranularityType.MultiDate))
                    {
                        _statsVm.GranularityModel = new GranularityModel
                        {
                            GranularityType = GranularityType.SingleDate,
                            SelectedDate    = startDate == DateTime.MinValue ? null : startDate,
                        };
                    }
                    else
                    {
                        if (startDate == endDate && startDate != DateTime.MinValue)
                        {
                            _statsVm.GranularityModel = new GranularityModel
                            {
                                GranularityType = GranularityType.SingleDate,
                                SelectedDate    = startDate == DateTime.MinValue ? null : startDate,
                            };
                        }
                        else
                        {
                            _statsVm.GranularityModel = new GranularityModel
                            {
                                GranularityType = GranularityType.MultiDate,
                                StartDate       = startDate == DateTime.MinValue ? null : startDate,
                                EndDate         = endDate == DateTime.MinValue ? null : endDate
                            };
                        }
                    }
                }

                if (!acceptGranularities.Contains(GranularityType.SingleRound) &&
                    !acceptGranularities.Contains(GranularityType.MultiRound))
                {
                    RoundAdjust.Visibility = Visibility.Collapsed;
                }
                else
                {
                    var startRound = (int?)CbStartRound.SelectedItem;
                    var endRound   = (int?)CbEndRound.SelectedItem;
                    if (!acceptGranularities.Contains(GranularityType.SingleRound))
                    {
                        _statsVm.GranularityModel = new GranularityModel
                        {
                            GranularityType = GranularityType.MultiRound,
                            StartRound      = startRound == -1 ? null : startRound,
                            EndRound        = endRound == -1 ? null : endRound
                        };
                    }
                    else if (!acceptGranularities.Contains(GranularityType.MultiRound))
                    {
                        _statsVm.GranularityModel = new GranularityModel
                        {
                            GranularityType = GranularityType.SingleRound,
                            SelectedRound   = startRound == -1 ? null : startRound,
                        };
                    }
                    else
                    {
                        if (startRound == endRound && startRound != -1)
                        {
                            _statsVm.GranularityModel = new GranularityModel
                            {
                                GranularityType = GranularityType.SingleRound,
                                SelectedRound   = startRound == -1 ? null : startRound,
                            };
                        }
                        else
                        {
                            _statsVm.GranularityModel = new GranularityModel
                            {
                                GranularityType = GranularityType.MultiRound,
                                StartRound      = startRound == -1 ? null : startRound,
                                EndRound        = endRound == -1 ? null : endRound
                            };
                        }
                    }
                }
            }

            await TemplateControl.UpdateGraph();
        }