More efficiently update contacts from messages.

Summary:
When we update contacts after syncing a message, it's faster* to do one database
query to get existing contacts, instead of doing a bunch of queries serially,
one for each participant in the message.

* faster = ~50-100ms less time for messages with many recipients.

Test Plan: Unit tests added.

Reviewers: khamidou

Reviewed By: khamidou

Differential Revision: https://review.inboxapp.com/D379