public void Update <TEntity>(TEntity entity) where TEntity : class { try { var entityObj = _dbContext.Find <TEntity>(entity.GetType().GetProperty("Id").GetValue(entity)); if (entityObj != null) { _dbContext.Entry(entityObj).State = //do this to be able to update the entity EntityState.Detached; //found entity isn’t tracked now } _dbContext.Update(entity); } catch (Exception) { throw; } }