public bool InsertStacks(int itemId, int amount)
{
if (amount < 0)
return false;
// Insert new stacks till amount is 0.
do
{
var stackItem = new Item(itemId);
var stackAmount = Math.Min(stackItem.Data.StackMax, amount);
stackItem.Amount = stackAmount;
amount -= stackAmount;
if (!this.Insert(stackItem, true))
return false;
}
while (amount > 0);
return true;
}