public void OnRemoveButtonClick()
    {
        if (_selectedItem != null)
        {
            //check if there's enough cargo space
            if (_selectedItem.Item.CargoUnits > ShipInventorySheet.AvailableCargoSpaceValue)
            {
                GameManager.Inst.UIManager.ErrorMessagePanel.DisplayMessage("NOT ENOUGH SPACE IN CARGO BAY");
                return;
            }

            if (_selectedItemContainer == EquipmentInventory)
            {
                //remove the item from slot and put it in cargo in loadout
                //determine the slot by "EquipmentType" attribute of the item
                CurrentLoadout.ClearEquipment(_selectedItem);
                CurrentLoadout.CargoBayItems.Add(_selectedItem);
            }
            else if (_selectedItemContainer == ShipModsInventory)
            {
                CurrentLoadout.CargoBayItems.Add(_selectedItem);
                CurrentLoadout.RemoveShipModByIndex(_selectedItemIndex);
                //also remove any dependencies
                //check if any mod depends on me
                List <InvItemData> dependencies = CurrentLoadout.GetModDependencies(_selectedItem.Item.ID);
                foreach (InvItemData dependency in dependencies)
                {
                    CurrentLoadout.RemoveShipMod(dependency);
                    CurrentLoadout.CargoBayItems.Add(dependency);
                }
            }

            Refresh();
        }
    }