private void UpdateTransactions(Domain.BankAccount bankAccount) { var transactions = db.Transactions.Where(x => x.bank_account_id == bankAccount.AccountNo); if (transactions.Any()) { db.Transactions.RemoveRange(transactions); db.SaveChanges(); } foreach (var transaction in bankAccount.GetTransactions()) { var trans = Factory.CreateNewTransaction(transaction); db.Transactions.Add(trans); db.SaveChanges(); } }