private static void OnUpdateOxygenLevel(ref UpdateOxygenLevelMsg msg, MyNetworkClient sender)
        {
            if (!MyEntities.EntityExists(msg.OwnerEntityId)) return;

            IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner;
            MyInventory inv = owner.GetInventory(msg.InventoryIndex);
            var item = inv.GetItemByID(msg.ItemId);
            if (!item.HasValue) return;

            var oxygenContainer = item.Value.Content as MyObjectBuilder_OxygenContainerObject;
            if (oxygenContainer != null)
            {
                oxygenContainer.OxygenLevel = msg.OxygenLevel;
                inv.UpdateOxygenAmount();
            }
        }
        public void UpdateOxygenLevel(MyInventory inv, float level, uint itemId)
        {
            Debug.Assert(Sync.IsServer);

            var msg = new UpdateOxygenLevelMsg();
            msg.OwnerEntityId = inv.Owner.EntityId;
            msg.InventoryIndex = inv.InventoryIdx;
            msg.ItemId = itemId;
            msg.OxygenLevel = level;

            Sync.Layer.SendMessageToAll(ref msg);
        }
        private static void OnUpdateOxygenLevel(ref UpdateOxygenLevelMsg msg, MyNetworkClient sender)
        {
            if (!MyEntities.EntityExists(msg.OwnerEntityId)) return;

            IMyInventoryOwner owner = MyEntities.GetEntityById(msg.OwnerEntityId) as IMyInventoryOwner;
            MyInventory inv = null;
            if (owner != null)
            {
                inv = owner.GetInventory(msg.InventoryIndex);
            }
            else
            {
                // NOTE: this should be the default code after we get rid of the inventory owner and should be searched by it's id
                MyEntity entity = MyEntities.GetEntityById(msg.OwnerEntityId);
                MyInventoryBase baseInventory;
                if (entity.Components.TryGet<MyInventoryBase>(out baseInventory))
                {
                    inv = baseInventory as MyInventory;
                }
            }
            
            var item = inv.GetItemByID(msg.ItemId);
            if (!item.HasValue) return;

            var oxygenContainer = item.Value.Content as MyObjectBuilder_OxygenContainerObject;
            if (oxygenContainer != null)
            {
                oxygenContainer.OxygenLevel = msg.OxygenLevel;
                inv.UpdateOxygenAmount();
            }
        }