Better data model and optimized indexing

Time counters and datestamps are not properly indexed and hence can't be properly queried (using ranges etc). Sorting on times did work because it was stored as strings that were lexicographically ordered, but there wasn't much that could have been done with it.

What I do here is move to using RavenDB best practices as well as fix bugs that weren't yet discovered as querying isn't fully implemented. I may even write some more tests if I'll be in the mood. I have more details in the individual commits.

This is still WIP as I work my way around the data that is being indexed for messages and fix the indexing and querying as I go along.

Comments welcome.