public void AddCartEntry(CartViewModel cartEntry) { var myCartEntry = _mapper.Map <Cart>(cartEntry); //This is done to avoid an error from the automapper, which is trying to insert a product myCartEntry.Product_FK = myCartEntry.Product.ID; myCartEntry.Product = null; _cartsRepo.AddProductToCart(myCartEntry); }