private void FillGameData()
 {
     if (reader.GetAttribute(0) == "White")
     {
         gameData.WhitePlayer = reader.GetAttribute("value");
     }
     else if (reader.GetAttribute(0) == "Black")
     {
         gameData.BlackPlayer = reader.GetAttribute("value");
     }
     else if (reader.GetAttribute(0) == "Result")
     {
         gameData.Result = reader.GetAttribute(1);
         GameDatabase.Add(gameCounter, gameData);
         gameCounter++;
         gameData = new GameData();
     }
 }
        internal RoundData StopCollectingRoundData(DateTime endTime)
        {
            if (CurrentRound == null)
            {
                return(null);
            }

            CurrentRound.Players   = PendingRoundData.Players;
            CurrentRound.Teams     = PendingRoundData.Teams;
            CurrentRound.Winner    = PendingRoundData.Winner;
            CurrentRound.TimeEnded = endTime;
            GameDatabase.SaveData(CurrentRound).Wait();
            GameDatabase.Add(CurrentRound).Wait();

            RoundData newRoundData = CurrentRound;

            CurrentRound     = null;
            PendingRoundData = new RoundData();

            return(newRoundData);
        }
        internal MatchData StopCollectingMatchData(DateTime time)
        {
            if (CurrentMatch == null)
            {
                return(null);
            }

            CurrentMatch.TimeEnded = time;
            CurrentMatch.Players   = PendingMatchData.Players;
            CurrentMatch.Teams     = PendingMatchData.Teams;
            CurrentMatch.Winner    = PendingMatchData.Winner;

            GameDatabase.SaveData(CurrentMatch).Wait();
            GameDatabase.Add(CurrentMatch).Wait();

            MatchData newMatchData = CurrentMatch;

            CurrentMatch     = null;
            PendingMatchData = new MatchData();
            return(newMatchData);
        }