def save(self, doc):
        if doc.id:
            return self.update(doc)
        else:
            return self.insert(doc)
def clear(self):
    for unused_ in range(len(self._items)):
      self.remove_item(self._items[0])