/// <summary>
        ///     Destroys given QNetPlayer.
        /// </summary>
        public static void DestroyQNetPlayer([NotNull] QNetPlayer player)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }
            InternalQNetPlayers.Remove(player);

            // rebuild array
            QNetPlayers = InternalQNetPlayers.ToArray();
        }
        /// <summary>
        ///     Creates new QNetPlayer instance based on given connection identity.
        /// </summary>
        /// <param name="connectionIdentity">Connection identity of player.</param>
        /// <param name="nickname">Nickname of player.</param>
        /// <param name="token"></param>
        public static QNetPlayer CreateQNetPlayer(short connectionIdentity, string nickname, uint token)
        {
            var connection = QNetManager.Server.GetConnection(connectionIdentity);

            if (connection.Equals(default(QNetConnection)))
            {
                throw new InvalidOperationException(
                          $"System was unable to create QNetPlayer on server. Connection of identity {connectionIdentity} not exist.");
            }

            var player = new QNetPlayer(connection, nickname, token);

            if (GetQNetPlayer(player.ConnectionIdentity) != null)
            {
                throw new InvalidOperationException(
                          "System is trying to create QNetPlayer of identity that already exist in this machine.");
            }

            InternalQNetPlayers.Add(player);

            // rebuild array
            QNetPlayers = InternalQNetPlayers.ToArray();
            return(player);
        }