Mongo timeout tweaks and refactoring

This started out as a branch to fix intermittent CI test failures. Certain tests were failing due to socket timeout errors when updating admin user creds in mongo. These operations were happening during test setup or teardown where not much other mongo activity is happening but the system would be busy. We were setting the mongo socket timeout to only 10s (which matches the mongo internal ping period). My theory is that the mongo socket timeout is too short and the busy system sees the socket timeout expire before data can be transfer and the socket is closed. I changed the timeout to 21s (2 x internal heartbeart time plus a bit).

The socket timeout was being set in a couple of places. And we had mongo specific stuff inside state. So I gathered the main bits of mongo functionality from state and moved agent/mongo to mongo and put it all in there. So the mongo stuff is all together and out of state.

I also updated the AddUser calls to UpsertUser because AddUser is deprecated in 2.4
Done