public void UpdateObject(GameObjectInstance obj)
        {
            var session   = sessions.Get(obj);
            var gobj      = gameData.GetGameObject(obj.ObjectId);
            var transform = gameData.GetTransform(gobj.TransformId);

            foreach (var playerConnection in connectionProvider.GetAllActivePlayerConnections(session))
            {
                playerConnection.Send(ObjectUpdate.Create(obj, transform, gobj.Static), SendOption.Reliable);
            }
        }
        public void LinkToGameSession(string sessionKey, PlayerConnection myConnection)
        {
            try
            {
                var session = sessions.GetOrCreate(sessionKey);

                session.AddPlayer(myConnection);

                if (!session.IsOpenWorldSession && session.Bot == null)
                {
                    var bot = botManager.GetMostAvailable();
                    if (bot != null)
                    {
                        session.AssignBot(bot);
                    }
                }

                var allPlayers  = session.Players.GetAll();
                var connections = connectionProvider.GetConnectedActivePlayerConnections(session);

                var objects = session.Objects.GetAll();
                var npcs    = session.Npcs.GetAll();

                var myInventory = playerInventoryProvider.GetInventory(myConnection.Player.Id);

                foreach (var connection in connections)
                {
                    var isMe = connection.InstanceID == myConnection.InstanceID;
                    if (isMe)
                    {
                        connection.Send(MyPlayerAdd.Create(gameData, myConnection.Player, myInventory.Items), SendOption.Reliable);
                        //connection.Send(PlayerInventory.Create(myConnection.Player, inventory.Items), SendOption.Reliable);
                    }
                    else
                    {
                        connection.Send(PlayerAdd.Create(gameData, myConnection.Player), SendOption.Reliable);
                    }
                }

                foreach (var player in allPlayers)
                {
                    if (player.Id == myConnection.Player.Id)
                    {
                        continue;
                    }
                    myConnection.Send(PlayerAdd.Create(gameData, player), SendOption.Reliable);
                }

                foreach (var obj in objects)
                {
                    var gobj      = gameData.GetGameObject(obj.ObjectId);
                    var transform = gameData.GetTransform(gobj.TransformId);
                    if (gobj.Static)
                    {
                        if (obj.Type != gobj.Type)
                        {
                            myConnection.Send(ObjectUpdate.Create(obj, transform, gobj.Static), SendOption.Reliable);
                        }
                    }
                    else
                    {
                        myConnection.Send(ObjectAdd.Create(obj, transform), SendOption.Reliable);
                    }
                }

                foreach (var npc in npcs)
                {
                    var transform = gameData.GetTransform(npc.TransformId);
                    myConnection.Send(NpcAdd.Create(gameData, npc, transform), SendOption.Reliable);
                }
            }
            catch (Exception exc)
            {
                logger.LogInformation(exc.ToString());
            }
        }