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

        Recursively un-registers all observers and removes references to child models. Extends the destroy method of
        the base class by child elements of a container state.
        """
        # logger.verbose("Prepare destruction container state ...")
        if recursive:
            for scoped_variable in self.scoped_variables:
                scoped_variable.prepare_destruction()
            for connection in self.transitions[:] + self.data_flows[:]:
                connection.prepare_destruction()
            for state in self.states.values():
                state.prepare_destruction(recursive)
        del self.scoped_variables[:]
        del self.transitions[:]
        del self.data_flows[:]
        self.states.clear()
        self.scoped_variables = None
        self.transitions = None
        self.data_flows = None
        self.states = None
        super(ContainerStateModel, self).prepare_destruction(recursive)
Prepares the model for destruction

        Recursively un-registers all observers and removes references to child models. Extends the destroy method of
        the base class by child elements of a container state.