public void Save(AccountDTO dto)
        {
            // Try and get the account
            var account = _accounts.Get(dto.AccountID);

            // If the account exists
            if (account != null)
            {
                // Update the account
                dto.MapTo(account);

                if (dto.TransactionDescriptionHistory != null)
                {
                    // Convert the list of descriptions back into a flat string, removing duplicates
                    account.TransactionDescriptionHistory = string.Join("|", dto.TransactionDescriptionHistory.Where(x => !string.IsNullOrWhiteSpace(x)).Distinct().ToArray());
                }

                _accounts.Update(account);
            }
            else
            {
                // Add the account
                account = _accounts.Add(dto.MapTo<Account>());

                // Update the DTO with the new ID
                dto.AccountID = account.AccountID;
            }
        }
        private TransactionType GetDefaultTransactionTypeForAccount(AccountDTO account)
        {
            var accountName = account.Name.ToUpper();

            // Try and work out if this is a savings/deposit account or a current account
            if (accountName.Contains("SAVING") || accountName.Contains("SAVER") || accountName.Contains("ISA"))
                return TransactionType.Income;

            return TransactionType.Expense;
        }
 public void Save(AccountDTO dto)
 {
     _accountServices.Save(dto);
 }