private async void InsertTodoItem(TodoItem todoItem)
 {
     // This code inserts a new TodoItem into the database. 
     // When the operation completes and Mobile Services has 
     // assigned an Id, the item is added to the collection.
     try
     {
         await todoTable.InsertAsync(todoItem);
         items.Add(todoItem);
     }
     catch (MobileServiceInvalidOperationException e)
     {
         MessageBox.Show(e.Message,
             string.Format("{0} (HTTP {1})",
             e.Response.Content,
             e.Response.StatusCode), MessageBoxButton.OK);
     }
 }
 private void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     var todoItem = new TodoItem { Text = TextInput.Text };
     InsertTodoItem(todoItem);
 }
 private async void UpdateCheckedTodoItem(TodoItem item)
 {
      await todoTable.UpdateAsync(item);     
 }
 private async void InsertTodoItem(TodoItem todoItem)
 {
     await todoTable.InsertAsync(todoItem);
 }
 private async void UpdateCheckedTodoItem(TodoItem item)
 {
     // This code takes a freshly completed TodoItem and updates the database. When the MobileService 
     // responds, the item is removed from the list.
     await todoTable.UpdateAsync(item);      
     items.Remove(item);
 }