public void DeleteAll() { Dictionary <int, bool> addressIdLookup = new Dictionary <int, bool>(); this.ForEach(item => addressIdLookup[item.HotBitcoinAddressId] = true); SwarmDb db = SwarmDb.GetDatabaseForWriting(); // Delete the unspents in this collection this.ForEach(item => db.DeleteHotBitcoinAddressUnspent(item.Identity)); // Recalculate the amount remaining in the addresses foreach (int addressId in addressIdLookup.Keys) { db.SetHotBitcoinAddressBalance(addressId, HotBitcoinAddress.FromIdentity(addressId).Unspents.AmountSatoshisTotal); } }