Refactor the currentUsers and contacts handling to ensure they handle async startup better

This PR is part of the work to fix the intermittent failures. The issue addressed here are:

* The contacts database may or may not have been loaded by the time the presence information has been received

This means we have to be able to handle locally stored contacts coming in after we've got the presence information.

As part of this, and to aid merges and updates of the currentUsers items, I have also changed currentUsers to be an object with keys of the user id, rather than an array of user information. This greatly simplifies accessing, updating and merging the users list.

I also see this as part of a progressive change where we may want to have a defined user class, rather than just objects.

There is still at least one intermittent failure, but we'll need to address that elsewhere/later.