def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def exitMode(self, mode):
        if mode in self.modeList:
            self.modeList.remove(mode)