Pretty stupid to use the company phone for texts to his girlfriend. I'm guessing that's what got him nailed in the end.
Then, there's having an affair - that's not all that bright for an FBI guy. No better way to compromise yourself than trying to hide that kind of thing.
The FBI would have to be in non-stop defense if he was still employed....IMO, the organization decided it couldn't endure it.
Now, some will say it's not like he paid off a porn star or a playboy bunny to keep quiet about sexual liaisons...or bashed a gold star family on twitter, or lied about their campaign having contact with Russians or colluding with Russians or lying about every thing large and small.....
BUT, the FBI has higher standards of conduct than Congress....which is a good thing.