public void SaveWithdrawAndRetreiveByTransacitonIdTest_SavesAnObjectToDatabaseAndManipulatesIt_ChecksIfItIsUpdatedAsExpected()
        {
            TransactionId transactionId = new TransactionId("transact123");
            Withdraw      withdraw      = new Withdraw(new Currency("LTC", true), "1234", DateTime.Now, WithdrawType.Bitcoin, 2000,
                                                       0.005m, TransactionStatus.Pending,
                                                       new AccountId(1), new BitcoinAddress("address123"));

            withdraw.SetTransactionId(transactionId.Value);

            _persistanceRepository.SaveOrUpdate(withdraw);

            Withdraw retrievedWithdraw = _withdrawRepository.GetWithdrawByTransactionId(transactionId);

            Assert.IsNotNull(retrievedWithdraw);
            retrievedWithdraw.SetAmount(777);
            _persistanceRepository.SaveOrUpdate(retrievedWithdraw);

            retrievedWithdraw = _withdrawRepository.GetWithdrawByTransactionId(new TransactionId("transact123"));
            Assert.AreEqual(withdraw.Currency.Name, retrievedWithdraw.Currency.Name);
            Assert.AreEqual(withdraw.WithdrawId, retrievedWithdraw.WithdrawId);
            Assert.AreEqual(withdraw.Type, retrievedWithdraw.Type);
            Assert.AreEqual(777, retrievedWithdraw.Amount);
            Assert.AreEqual(withdraw.Fee, retrievedWithdraw.Fee);
            Assert.AreEqual(withdraw.Status, retrievedWithdraw.Status);
            Assert.AreEqual(withdraw.AccountId.Value, retrievedWithdraw.AccountId.Value);
        }
        /// <summary>
        /// Handler when the timer has been elapsed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="elapsedEventArgs"></param>
        private void OnTimerElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
        {
            Log.Debug(string.Format("Withdraw Timer Elapsed."));
            Timer timer = sender as Timer;

            if (timer != null)
            {
                timer.Stop();
                timer.Dispose();
                Log.Debug(string.Format("Withdraw Timer Stopped"));
                Withdraw withdraw = null;
                _withdrawTimersDictionary.TryGetValue(timer, out withdraw);
                if (withdraw != null)
                {
                    Log.Debug(string.Format("Submitting Withdraw to network: Account ID = {0}, Currency = {1}", withdraw.AccountId.Value, withdraw.Currency.Name));
                    // Selecct the coin client service to which to send the withdraw
                    ICoinClientService coinClientService = SelectCoinService(withdraw.Currency.Name);
                    string             transactionId     = coinClientService.CommitWithdraw(
                        withdraw.BitcoinAddress.Value, withdraw.Amount);
                    if (string.IsNullOrEmpty(transactionId))
                    {
                        Log.Error(string.Format("Withdraw could not be submitted to network: Account ID = {0}, Currency = {1}", withdraw.AccountId.Value, withdraw.Currency.Name));
                    }
                    else
                    {
                        Log.Debug(string.Format("Withdraw submitted succcessfully to network: Account ID = {0}, Currency = {1}", withdraw.AccountId.Value, withdraw.Currency.Name));
                        // Set transaction Id recevied from the network
                        withdraw.SetTransactionId(transactionId);

                        /*
                         * // Set status as confirmed
                         * withdraw.StatusConfirmed();
                         * // Save the withdraw
                         * _fundsPersistenceRepository.SaveOrUpdate(withdraw);*/
                        _withdrawTimersDictionary.Remove(timer);
                        if (WithdrawExecuted != null)
                        {
                            WithdrawExecuted(withdraw);
                        }
                    }
                }
            }
        }