Rearrange simulateUpsertWithInsertedId() for readability