Fixed #21566 -- Fixed AttributeError when using bulk_create with ForeignObject.