There should be a method to remove the items from inventory without need for iterating the data on your own. It should be safer.