Properly handles foreign keys as an array now to account for more than one.