Use Batch API when processing foreign keys