def save(self, unique=False): """Stores this Model in Cassandra in one batch update.""" from homer.core.types import TypedCollection model = MetaModel(self) if model.created: model.update() else: model.new(unique) properties = fields(self, CqlProperty) for name, property in properties.items(): #Commit the changes in all collections within this model. if isinstance(property, CqlCollection): value = self[name] if isinstance(value, TypedCollection): value.commit() self.differ.commit() #Commit the differ for the model finally. self.__saved = True #Mark this model as saved.