title: RavenDB with asp.net mvc Update Issue
body: <p>I have a small project in asp.net mvc 3 and I am using RavenDB to store data.
  But when i am trying to update entity i have error saying 
  "<strong><em>Attempted to associate a different object with id 'orders/257</em></strong>'"
  I have a service class to menage entities.</p>
  
  <p>This is method to update entity called Order.
  I'v omitted the rest of methods baceuse of clarity</p>
  
  <pre><code>  public ErrorState UpdateOrder(Order order)
      {
          try
          {
              documentSession.Store(order);
              documentSession.SaveChanges();
              return new ErrorState { Success = true };
  
          }
          catch (Exception ex)
          {
              return new ErrorState { Success = false, ExceptionMessage = ex.Message };
  
          }
      }
  </code></pre>
  
  <p>This is rest of OrderRepository</p>
  
  <pre><code>  private readonly IDocumentSession documentSession;
  
  public OrderRepository(IDocumentSession _documentSession)
  {
      documentSession = _documentSession;
  }
  </code></pre>
  
  <p>ErrorState class is for menagege errors in app, it contains bool success and string message of exception.</p>
  
  <p>This is my edit Actions.</p>
  
  <pre><code> public ActionResult Edit(int id)
          {
              Order order = orderRepository.ObtainOrder(id);
              if (order == null)
              {
                  TempData["message"] = string.Format("Order no: {0} not found", id);
                  return RedirectToAction("Index");
              }
              return View(order);
  
          }
  
  
  
          [HttpPost]
          public ActionResult Edit(Order order)
          {
              if(!ModelState.IsValid)
                  return View();
  
              errorState = orderRepository.UpdateOrder(order);
              if (errorState.Success)
              {
                  TempData["message"] = string.Format("Order no: {0} has been changed", order.Id);
                  return RedirectToAction("Index");
              }
              else
              {
                  TempData["Message"] = string.Format("Error on update order no: {0} MSG: {1}", order.Id,errorState.ExceptionMessage);
                  return RedirectToAction("Index");
              }
  
  
          }
  </code></pre>
  
  <p>This is the rest of the controller , I'v omitted the rest of actions baceuse of clarity.</p>
  
  <pre><code>private readonly IOrderRepository orderRepository;
  private ErrorState errorState;
  
  public HomeController(IOrderRepository _orderRepository,IDocumentSession _documentSession)
  {
      orderRepository = _orderRepository;
  
  } 
  </code></pre>