function applyTimestampsToChildren(schema, res, options) {
  for (const childSchema of schema.childSchemas) {
    const _path = childSchema.model.path;
    const _schema = childSchema.schema;
    if (!_path) {
      continue;
    }
    const _obj = mpath.get(_path, res);
    if (_obj == null || (Array.isArray(_obj) && _obj.flat(Infinity).length === 0)) {
      continue;
    }

    applyTimestamps(_schema, _obj, options);
  }
}
Apply timestamps to any subdocuments

@param {Schema} schema subdocument schema
@param {Object} res subdocument
@param {Object} [options]
@param {Boolean} [options.isUpdate=false] if true, treat this as an update: just set updatedAt, skip setting createdAt. If false, set both createdAt and updatedAt
@param {Function} [options.currentTime] if set, Mongoose will call this function to get the current time.