Each item has
Code:
attribute id="owner" 
and
Code:
 attribute id="inventory" 
attributes. The former determines the ownership of the item, and the latter determines which the inventory the item is in. You have to find out the owner Id and inventory id, and swap them.