Making the nullable foreign key check in _extract_data a little cleaner