def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def serialize(self):
        s = []
        for v in self:
            if isinstance(v, BaseConfig):
                v = v.serialize()
            s.append(v)
        return s