Can someone please check out this code, i really dont understand why i got violation of unique when i try to update an record. the code used to create new record work just fine, but when i try to use it to update, it called out violation.

Controller: 

```
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Edit(User user)
    {
        if (ModelState.IsValid)
        {
            userRepository.SaveUser(user);
            return RedirectToAction("List");
        }
        else
            return View("Edit");
    }

```

userRepo:

```
    public void SaveUser(User user)
    {
        user.LAST_ACTIVITY = DateTime.Now;
        if (user.USER_ID != 0)
        {
            usersTable.Attach(user);
            usersTable.Context.Refresh(RefreshMode.KeepCurrentValues, user);
        }
        else
        {
            usersTable.InsertOnSubmit(user);
        }
        usersTable.Context.SubmitChanges();
    }

```

and i got an error:

> 
> Unable to refresh the specified
>  object. The object no longer exists
>  in the database.
> 
> 
> 

when i try to change the userRepo like this for testing purpose.

```
    public void SaveUser(User user)
    {
        user.LAST_ACTIVITY = DateTime.Now;
        usersTable.Attach(user);
        usersTable.Context.Refresh(RefreshMode.KeepCurrentValues, user);
        usersTable.Context.SubmitChanges();
    }

```

Im wondering if there anyone on this board can find out if i am wrong somewhere in this problem :).

Thank you very much and wish you best regard. :)