'Writes the changes in this object to the datastore.'

def Flush(self):

    self.data_store.StoreRequestsAndResponses(new_requests=self.request_queue, new_responses=self.response_queue, requests_to_delete=self.requests_to_delete, token=self.token)
    mutation_pool = self.data_store.GetMutationPool(token=self.token)
    with mutation_pool:
        for (client_id, messages) in self.client_messages_to_delete.iteritems():
            self.Delete(client_id.Queue(), messages, mutation_pool=mutation_pool)
        if self.new_client_messages:
            for (timestamp, messages) in utils.GroupBy(self.new_client_messages, (lambda x: x[1])).iteritems():
                self.Schedule([x[0] for x in messages], timestamp=timestamp, mutation_pool=mutation_pool)
    if self.notifications:
        for notification in self.notifications.itervalues():
            self.NotifyQueue(notification, mutation_pool=mutation_pool)
        mutation_pool.Flush()
    self.request_queue = []
    self.response_queue = []
    self.requests_to_delete = []
    self.client_messages_to_delete = {}
    self.notifications = {}
    self.new_client_messages = []
