Fix recreateIds query not always returning the highest numeric ID

This query would sort by tracker:id and expect the highest result to
have the highest numeric event or group ID, which can be a false
assumption depending on insertion order. This could result in the
highest group ID being set incorrectly, and eventually adding events to
an incorrect group.

Unfortunately, since the actual numeric ID is contained in a URI, and it
appears impossible to get substrings within tracker sparql queries, the
best solution I can find is to query all events and sort the IDs in
code.
Merge pull request #12 from special/recreateids

Fix recreateIds query not always returning the highest numeric ID