Wouldn't it be better if `getAttachments` returned `null` instead of an empty object when no attachments are present in the document? That way you wouldn't need to do `Object.keys(attachments).length > 0;` in multiple places below; and this would also be consistent with `getOutline`.