public Money Withdraw(decimal requestedSum) { Log.Info("Request for withdrw " + requestedSum); AtmState result; List <MutablePair <decimal, int> > combination; var moneyForWithdraw = new Money(); if (_moneyCassettes == null || _moneyCassettes.Count == 0) { return(moneyForWithdraw); } if (_banknoteSelector.TrySelect(ConvertCassettes(), requestedSum, out result, out combination)) { UpdateCassettes(combination); moneyForWithdraw = (Money)PreparedMoney.Clone(); } CurrentState = result; Log.Info(_logViewer.ToString(moneyForWithdraw, result)); // Statistics.Update(requestedSum,moneyForWithdraw, CurrentState,new List<Cassette>(_moneyCassettes)); AtmEvent.OnWithdrawMoneyEvent(requestedSum, CurrentState, moneyForWithdraw); return(moneyForWithdraw); }