/// <summary>
        /// Build DAOs if we need to build DAOs
        /// </summary>
        /// <param name="connection">the current <see cref="MySqlConnection"/></param>
        /// <param name="playerDAO">DAO for <see cref="Player"/>s</param>
        /// <param name="missionDAO">DAO for <see cref="Mission"/>s</param>
        /// <param name="sessionDAO">DAO for <see cref="Session"/>s</param>
        /// <param name="pstmsDAO">DAO for <see cref="PlayerSessionToMissionSession"/>s</param>
        private void BuildDAOsIfNeeded(ref MySqlConnection connection,
                                       ref PlayerDAO playerDAO,
                                       ref MissionDAO missionDAO,
                                       ref SessionDAO sessionDAO,
                                       ref PlayerSessionToMissionSessionDAO pstmsDAO) {

            if (connection == null || connection.State == ConnectionState.Closed) {
                connection = DatabaseUtil.OpenDataSource();
                playerDAO = new PlayerDAO(connection);
                missionDAO = new MissionDAO(connection);
                sessionDAO = new SessionDAO(connection);
                pstmsDAO = new PlayerSessionToMissionSessionDAO(connection);
            }
        }
 /// <summary>
 /// Helper method to update the session info
 /// </summary>
 /// <param name="serverInfoService">service to get info from an A3 server</param>
 /// <param name="sessionDAO">DAO for <see cref="Session"/>s</param>
 /// <param name="playerDAO">DAO for <see cref="Player"/>s</param>
 /// <param name="missionDAO">DAO for <see cref="Mission"/>s</param>
 /// <param name="pstmsDAO">DAO for <see cref="PlayerSessionToMissionSession"/>s</param>
 /// <param name="host">A3 server host</param>
 /// <param name="port">A3 server port</param>
 /// <param name="session">The current game <see cref="Session"/></param>
 /// <param name="missionCount">The number of missions played</param>
 /// <param name="inGame">Boolean to check if the server is currently in game</param>
 /// <returns>The current mission session</returns>
 private Session UpdateInfo(ServerInfoService serverInfoService, SessionDAO sessionDAO, PlayerDAO playerDAO, MissionDAO missionDAO, PlayerSessionToMissionSessionDAO pstmsDAO,
                            string host, int port, Session session, ref int missionCount, ref bool inGame) {
     ServerInfo serverInfo = serverInfoService.GetServerInfo(host, port);
     inGame = CheckServerRunningState(serverInfo.ServerState);
     if (inGame) {
         UpdateSessionData(sessionDAO, session, serverInfo);
         MissionSession missionSession = UpdateMissionData(missionDAO, session, serverInfo, ref missionCount);
         ISet<PlayerSession> playerSessions = UpdatePlayerData(playerDAO, session, serverInfo, missionSession);
         UpdatePTSTMTSData(pstmsDAO, missionSession, playerSessions);
     }
     return session;
 }
        /// <summary>
        /// Helper method to update <see cref="Session"/> data in the database
        /// </summary>
        /// <param name="sessionDAO">DAO for <see cref="Session"/>s</param>
        /// <param name="session">The current game <see cref="Session"/></param>
        /// <param name="serverInfo">The current <see cref="ServerInfo"/></param>
        private void UpdateSessionData(SessionDAO sessionDAO, Session session, ServerInfo serverInfo) {
            bool updateSession = false;

            if (session.MaxPing < serverInfo.Ping) {
                session.MaxPing = serverInfo.Ping;
                updateSession = true;
            } else if (session.MinPing > serverInfo.Ping) {
                session.MinPing = serverInfo.Ping;
                updateSession = true;
            }

            if (session.MaxPlayers < serverInfo.Players.Count) {
                session.MaxPlayers = serverInfo.Players.Count;
                updateSession = true;
            }

            if (updateSession) {
                sessionDAO.UpdateSession(session);
            }
        }
        /// <summary>
        /// Helper method to create a new session
        /// </summary>
        /// <param name="serverInfoService">service to get info from an A3 server</param>
        /// <param name="sessionDAO">DAO for sessions</param>
        /// <param name="host">A3 server host</param>
        /// <param name="port">A3 server port</param>
        /// <param name="inGame">Boolean to check if the server is currently in game</param>
        /// <returns>The new session</returns>
        private Session SetUpSession(ServerInfoService serverInfoService, SessionDAO sessionDAO, string host, int port, ref bool inGame) {
            Session returnSession = null;

            // initial info grab
            ServerInfo serverInfo = serverInfoService.GetServerInfo(host, port);
            inGame = CheckServerRunningState(serverInfo.ServerState);

            if (inGame) {
                // create a session
                Session session = new Session();
                session.HostName = serverInfo.HostName;
                session.Version = serverInfo.GameVersion;
                session.MaxPing = serverInfo.Ping;
                session.MinPing = serverInfo.Ping;
                session.MaxPlayers = serverInfo.NumPlayers;
                session = sessionDAO.CreateSession(session);

                returnSession = session;
            }

            return returnSession;
        }