Two minor observation regarding stl: first off, you can provide an iterator to insert that will act as a hint to where you want to insert the element. This avoids having the double look-up you have going on here. Or even easier just use this:

```c++
if (!agentAccounts.insert(account).second) continue;
```