Hi Sara,
The key mapping is essentially a hash that allows you to lookup an ID based on your own IDs. So, if you're sending in more than one metadata object, you should assign a foreignid to them, then you can iterate over the key mapping looking for the item that matches the ID you put in.
It's a little weird, but it was the only way I could figure out to allow bulk uploads of data and still allow you to have ID associations on auto incremented numerical keys.
Another strategy you can use is to assign guids to the items before passing them in. If a guid is assigned then the system will use that instead of generating a new one and you can just store the value.