public async Task ClearMatch(bool isRematch)
        {
            if (_isRunning)
            {
                await EndRound();
            }

            _wsMonitor.DisableScoring();
            if (!isRematch)
            {
                _wsMonitor.RemoveAllCharacterSubscriptions();
            }
            _messageService.DisableLogging();

            var previousWorldId         = MatchConfiguration.WorldIdString;
            var previousIsManualWorldId = MatchConfiguration.IsManualWorldId;

            var previousEndRoundOnFacilityCapture         = MatchConfiguration.EndRoundOnFacilityCapture;
            var previousIsManualEndRoundOnFacilityCapture = MatchConfiguration.EndRoundOnFacilityCapture;

            MatchConfiguration = new MatchConfiguration();

            if (isRematch)
            {
                MatchConfiguration.TrySetWorldId(previousWorldId, previousIsManualWorldId);
                MatchConfiguration.TrySetEndRoundOnFacilityCapture(previousEndRoundOnFacilityCapture, previousIsManualEndRoundOnFacilityCapture);
            }
            else
            {
                var activeRuleset = await _rulesetManager.GetActiveRulesetAsync();

                MatchConfiguration.TrySetEndRoundOnFacilityCapture(activeRuleset.DefaultEndRoundOnFacilityCapture, false);
            }

            _roundSecondsMax = MatchConfiguration.RoundSecondsTotal;

            _matchState   = MatchState.Uninitialized;
            _currentRound = 0;

            _matchDataService.CurrentMatchRound = _currentRound;
            _matchDataService.CurrentMatchId    = string.Empty;

            _latestTimerTickMessage = null;

            if (isRematch)
            {
                _teamsManager.UpdateAllTeamsMatchSeriesResults(CurrentSeriesMatch);
                _teamsManager.ResetAllTeamsMatchData();
            }
            else
            {
                CurrentSeriesMatch = 0;

                _teamsManager.ClearAllTeams();
            }

            SendMatchStateUpdateMessage();
            SendMatchConfigurationUpdateMessage();
        }
        public ScrimMatchEngine(IScrimTeamsManager teamsManager, IWebsocketMonitor wsMonitor, IStatefulTimer timer,
                                IScrimMatchDataService matchDataService, IScrimMessageBroadcastService messageService, IScrimRulesetManager rulesetManager, ILogger <ScrimMatchEngine> logger)
        {
            _teamsManager     = teamsManager;
            _wsMonitor        = wsMonitor;
            _timer            = timer;
            _messageService   = messageService;
            _matchDataService = matchDataService;
            _rulesetManager   = rulesetManager;

            // Copy default values to match config
            var activeRuleset = rulesetManager.ActiveRuleset;

            MatchConfiguration.TrySetTitle(activeRuleset.DefaultMatchTitle, false);
            MatchConfiguration.TrySetRoundLength(activeRuleset.DefaultRoundLength, false);
            MatchConfiguration.TrySetEndRoundOnFacilityCapture(activeRuleset.DefaultEndRoundOnFacilityCapture, false);

            _logger = logger;

            _messageService.RaiseMatchTimerTickEvent += async(s, e) => await OnMatchTimerTick(s, e);

            _messageService.RaiseTeamOutfitChangeEvent += OnTeamOutfitChangeEvent;
            _messageService.RaiseTeamPlayerChangeEvent += OnTeamPlayerChangeEvent;

            _messageService.RaiseScrimFacilityControlActionEvent += async(s, e) => await OnFacilityControlEvent(s, e);
        }