Nit:  Do we really need the check for `undefined` here?  The `!selectedContacts[id]` will resolve to true since regardless since `undefined` is a falsy value.