Migrate putAll to upsert