public ActionResult RemoveFromBasket(int id) { BasketRepository br = new BasketRepository(); var user = UserManager.FindByEmail(this.User.Identity.Name); if (user != null) { userId = user.Id; } if (!string.IsNullOrWhiteSpace(userId)) { var item = br.LoadById(id); if (item.UserId == userId) { //valid user, allow delete item.ArchiveDateUTC = DateTime.UtcNow; br.RemoveFromBasket(item); } } return(View()); }