If the reference is loaded, unload it.

        .. Note:: Do not confuse this with a delete. This means, that the reference stays in the
                  scene, but no data is read from the reference.

        This will call :meth:`RefobjInterface.unload` and set the status to :data:`Reftrack.UNLOADED`.
        It will also throw away all children :class:`Reftrack`. They will return after :meth:`Reftrack.load`.

        The problem might be that children depend on their parent, but will not get unloaded.
        E.g. you imported a child. It will stay in the scene after the unload and become an orphan.
        In this case an error is raised. It is not possible to unload such an entity.
        The orphan might get its parents back after you call load, but it will introduce bugs when
        wrapping children of unloaded entities. So we simply disable the feature in that case and raise
        an :class:`IntegrityError`

        :returns: None
        :rtype: None
        :raises: :class:`ReftrackIntegrityError`

def unload(self, ):
        """If the reference is loaded, unload it.

        .. Note:: Do not confuse this with a delete. This means, that the reference stays in the
                  scene, but no data is read from the reference.

        This will call :meth:`RefobjInterface.unload` and set the status to :data:`Reftrack.UNLOADED`.
        It will also throw away all children :class:`Reftrack`. They will return after :meth:`Reftrack.load`.

        The problem might be that children depend on their parent, but will not get unloaded.
        E.g. you imported a child. It will stay in the scene after the unload and become an orphan.
        In this case an error is raised. It is not possible to unload such an entity.
        The orphan might get its parents back after you call load, but it will introduce bugs when
        wrapping children of unloaded entities. So we simply disable the feature in that case and raise
        an :class:`IntegrityError`

        :returns: None
        :rtype: None
        :raises: :class:`ReftrackIntegrityError`
        """
        assert self.status() == self.LOADED,\
            "Cannot unload if there is no loaded reference. \
Use delete if you want to get rid of a reference or import."
        childrentodelete = self.get_children_to_delete()
        if childrentodelete:
            raise ReftrackIntegrityError("Cannot unload because children of the reference would become orphans.", childrentodelete)
        self.get_refobjinter().unload(self._refobj)
        self.set_status(self.UNLOADED)
        self.throw_children_away()
        self.update_restrictions()
        self.emit_data_changed()