public int InsertLoanCycle(LoanCycle loanCycle) { if (_productManager.IsLoanCycleNameAlreadyExist(loanCycle.Name)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.LoanCycleNameAlreadyExists); } using (SqlConnection conn = _productManager.GetConnection()) using (SqlTransaction t = conn.BeginTransaction()) { try { loanCycle.Id = _productManager.InsertLoanCycle(loanCycle, t); t.Commit(); return(loanCycle.Id); } catch (Exception ex) { t.Rollback(); throw ex; } } }