public void Transfer(double pAmount, int pFromAcctNumber, int pToAcctNumber, Guid pOrderNumber, string pReturnAddress) { using (TransactionScope lScope = new TransactionScope()) using (BankEntityModelContainer lContainer = new BankEntityModelContainer()) { //IOperationOutcomeService lOutcomeService = OperationOutcomeServiceFactory.GetOperationOutcomeService(pResultReturnAddress); try { Account lFromAcct = GetAccountFromNumber(pFromAcctNumber); Account lToAcct = GetAccountFromNumber(pToAcctNumber); lFromAcct.Withdraw(pAmount); lToAcct.Deposit(pAmount); lContainer.Attach(lFromAcct); lContainer.Attach(lToAcct); lContainer.ObjectStateManager.ChangeObjectState(lFromAcct, System.Data.EntityState.Modified); lContainer.ObjectStateManager.ChangeObjectState(lToAcct, System.Data.EntityState.Modified); NotificationService.NotificationServiceClient IClient = new NotificationService.NotificationServiceClient("NetMsmqBinding_INotificationService", pReturnAddress); IClient.NotifyBankTransactionCompleted(pOrderNumber, OperationOutcome.Successful); lContainer.SaveChanges(); lScope.Complete(); //lOutcomeService.NotifyOperationOutcome(new OperationOutcome() { Outcome = OperationOutcome.OperationOutcomeResult.Successful }); } catch (Exception lException) { Console.WriteLine("Error occured while transferring money: " + lException.Message); NotificationService.NotificationServiceClient IClient = new NotificationService.NotificationServiceClient("NetMsmqBinding_INotificationService", pReturnAddress); IClient.NotifyBankTransactionCompleted(pOrderNumber, OperationOutcome.Failure); lScope.Complete(); //throw; //lOutcomeService.NotifyOperationOutcome(new OperationOutcome() { Outcome = OperationOutcome.OperationOutcomeResult.Failure, Message = lException.Message }); } } }