// The following method handles the MouseLeftButtonUp event.
 // It commits any changes made to the ModelItem which represents the
 // the adorned control.
 void slider_MouseLeftButtonUp(
     object sender,
     System.Windows.Input.MouseButtonEventArgs e)
 {
     if (batchedChange != null)
     {
         batchedChange.Complete();
         batchedChange.Dispose();
         batchedChange = null;
     }
 }
 public void EndEdit()
 {
     try
     {
         _scope.Complete();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
     finally
     {
         _scope.Dispose();
         _scope = null;
         if (_session != null)
         {
             _session.Close();
             _session = null;
         }
     }
 }