'Store the watchrule in the database and return its ID.
If self.id is set, we update the existing rule.'

def store(self):

    wr_values = {'name': self.name, 'rule': self.rule, 'state': self.state, 'stack_id': self.stack_id}
    if (self.id is None):
        wr = watch_rule_objects.WatchRule.create(self.context, wr_values)
        self.id = wr.id
    else:
        watch_rule_objects.WatchRule.update_by_id(self.context, self.id, wr_values)
