def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def __init__(
        self, minimum=None, maximum=None, choices=None, optional=False
    ):
        self._required = not optional
        self._minimum = minimum
        self._maximum = maximum
        self._choices = choices