Delete the current entity.

        This will also call :meth:`RefobjInterface.get_children_to_delete` and
        delete these children first by calling :meth:`Reftrack.delete`.
        To delete the content it will call :meth:`RefobjInterface.delete`.
        Then the refobject will be set to None. If the :class:`Reftrack` object is an alien to
        the current scene, because it is not linked in the database, it will also remove itself
        from the root and from the treemodel.
        If it is not an alien, it will just empty all of tis children and update its status.

        :param removealien: If True, remove this reftrack, if it is an alien
        :type removealien: :class:`bool`
        :returns: None
        :rtype: None
        :raises: None

def delete(self, removealien=True):
        """Delete the current entity.

        This will also call :meth:`RefobjInterface.get_children_to_delete` and
        delete these children first by calling :meth:`Reftrack.delete`.
        To delete the content it will call :meth:`RefobjInterface.delete`.
        Then the refobject will be set to None. If the :class:`Reftrack` object is an alien to
        the current scene, because it is not linked in the database, it will also remove itself
        from the root and from the treemodel.
        If it is not an alien, it will just empty all of tis children and update its status.

        :param removealien: If True, remove this reftrack, if it is an alien
        :type removealien: :class:`bool`
        :returns: None
        :rtype: None
        :raises: None
        """
        if self.status() is None:
            parent = self.get_parent()
            if parent:
                parent.remove_child(self)
            self._treeitem.parent().remove_child(self._treeitem)
            self.get_root().remove_reftrack(self)
            return
        todelete = self.get_children_to_delete()
        allchildren = self.get_all_children()
        for c in reversed(todelete):
            c._delete()
        for c in allchildren:
            self.get_root().remove_reftrack(c)
        self._delete()
        if self.alien() and removealien:
            self.get_root().remove_reftrack(self)
        self.update_restrictions()
        self.emit_data_changed()