public static bool Prefix(ref InventoryUiUtils __instance, ref InventoryUiContext ___m_context)
        {
            try {
                var tab = __instance.Tab;
                if (tab != null)   // Restack online storage.
                {
                    if (tab is InventoryOnlineSlotPanelUi onlineTab)
                    {
                        var onlineCargo = onlineTab.GetCargo();

                        if (onlineCargo.ValidateUser(___m_context.User))
                        {
                            var resorter = new Resorter();

                            foreach (var inventory in onlineCargo.Inventories)
                            {
                                if (inventory.TryCast(out IInventorySlots inventorySlots))
                                {
                                    resorter.ExtractAllItemsToTemp(inventory, inventorySlots);
                                }
                            }

                            resorter.ResortTempList();
                            resorter.PutTempItemsInInventory(onlineCargo);
                        }
                    }
                    else     // Restack single inventory.
                    {
                        for (var i = 0; i < tab.InventoryCount; i++)
                        {
                            var inventoryView = tab[i];
                            if (inventoryView.Inventory.TryCast(out IInventorySlots _) && inventoryView.Inventory.ValidateUser(___m_context.User))
                            {
                                InventoryControl.Restack(inventoryView.Inventory);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                Debug.LogError($"Error resorting: {e}");
            }

            return(false);
        }