def insert(self, doc, synced=False):
        doc.id = self.get_next_id()
        doc.synced = synced
        try:
            self.db.docs.insert(doc)
        except Exception as e:
            raise DatabaseException(e)
        return 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