public async Task <TIEntity> Update(TIEntity entity) { var _entity = await this.SSOContext.Set <TEntity>().FindAsync(entity.Id); if (_entity == null) { throw new System.Exception($"Record not found. {typeof(TEntity).Name}"); } using (var tx = SSOContext.Database.BeginTransaction()) { SSOContext.Update(entity); await SSOContext.SaveChangesAsync(); await tx.CommitAsync(); } return(entity); }