'Persist stack state to database'

def _persist_state(self):

    if (self.id is None):
        return
    stack = stack_object.Stack.get_by_id(self.context, self.id, eager_load=False)
    if (stack is not None):
        values = {'action': self.action, 'status': self.status, 'status_reason': six.text_type(self.status_reason)}
        self._send_notification_and_add_event()
        if self.convergence:
            updated = stack_object.Stack.select_and_update(self.context, self.id, values, exp_trvsl=self.current_traversal)
            return updated
        else:
            stack.update_and_save(values)
