public bool InsertList(List <Referee> referee) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted); var @select = new RefereeBO().Select(ConnectionHandler, x => x.Id); var refereeBo = new RefereeBO(); foreach (var refe in referee) { if (@select.All(x => x != refe.Id)) { if (!refereeBo.Insert(this.ConnectionHandler, this.EnterpriseNodeConnection, refe)) { throw new Exception(Resources.Congress.ErrorInSaveUser); } @select.Add(refe.Id); } else { if (!refereeBo.Update(this.ConnectionHandler, this.EnterpriseNodeConnection, refe)) { throw new Exception(Resources.Congress.ErrorInSaveUser); } } } this.ConnectionHandler.CommitTransaction(); this.EnterpriseNodeConnection.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.EnterpriseNodeConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.EnterpriseNodeConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }