async function prepareAttributes(attributes, asArray = false) {
  const sanitized = {}
  for (const name in attributes) {
    const value = Array.isArray(attributes[name])
      ? attributes[name]
      : [attributes[name]]
    const prepValue = asArray ? value : value[0]
    // console.log(`name ${name}`, prepValue)
    const data = await prepareData(prepValue, sanitizeAttribute)
    /* Remove any null/undefined values */
    if (!isNullOrUndef(data)) {
      sanitized[name] = data
    }
  }
  return sanitized
}
Prepares an object for inclusion in endpoint data or event data.

@param {Object} attributes
@param {Boolean} asArray If true ensure an array of strings is returned for each property