DRY up collection handling, also fix NIL error

Previously we were attempting to call .first on NIL.
Arguably identityMetadata_objectId_t should always be populated, but
in practice during testing it was not.  #dealwithit