If you get to this point, you can insert (contactIds.size() - queriedContactsSize) empty contacts, and break.