[qtcontacts-sqlite] Improve aggregate search logic

Determine maximum aggregate contact id prior to batch save, and avoid
attempting to aggregate multiple contacts from the same sync target.
This improves performance significantly as the database size grows.