def prepare_destruction(self, recursive=True):
        """Prepares the model for destruction

        Recursively un-registers all observers and removes references to child models
        """
        if self.state is None:
            logger.verbose("Multiple calls of prepare destruction for {0}".format(self))
        self.destruction_signal.emit()
        try:
            self.unregister_observer(self)
        except KeyError:  # Might happen if the observer was already unregistered
            logger.verbose("Observer already unregistered!")
            pass
        if recursive:
            if self.income:
                self.income.prepare_destruction()
            for port in self.input_data_ports[:] + self.output_data_ports[:] + self.outcomes[:]:
                port.prepare_destruction()
        del self.input_data_ports[:]
        del self.output_data_ports[:]
        del self.outcomes[:]
        self.state = None
        self.input_data_ports = None
        self.output_data_ports = None
        self.income = None
        self.outcomes = None
        # History TODO: these are needed by the modification history
        # self.action_signal = None
        # self.meta_signal = None
        # self.destruction_signal = None
        self.observe = None
        super(AbstractStateModel, self).prepare_destruction()
Prepares the model for destruction

        Recursively un-registers all observers and removes references to child models