public override void UnloadContent()
 {
     EntitySelector.Deselect();
     EntitySelector.PlaceEntity();
     this.active = false;
     this.updateThread.Abort();
     this.SendUpdate();
     UsersManager.LogoutCurrentUser();
     UsersManager.CurrentPlayer = null;
     ModelsManager.Instance.DisposeAll();
 }
        private void CleanDead()
        {
            var markedForDestruction = UsersManager.CurrentPlayer.Units.Where(u => u.IsAlive == false).ToArray();

            foreach (var unit in markedForDestruction)
            {
                this.deadUnits.Enqueue(unit);
                UsersManager.CurrentPlayer.Units.Remove(unit);
                UsersManager.CurrentPlayer.AllEntities.Remove(unit);
                if (EntitySelector.EntityPicked == unit || EntitySelector.EntitySelected == unit)
                {
                    EntitySelector.Deselect();
                    EntitySelector.PlaceEntity();
                }

                if (this.details?.Entity == unit)
                {
                    this.details = null;
                }
            }
        }