Fix issue when multiple records need to be ignored

The previous fix to ignore records that are not referenced in the parent
set only worked for the first record referencing a parent. If there was
more than one record referencing the same non-existent parent it still
failed.

This moves the ignore check outside the current_record_id check and
fixes the issue.