async filesGenerationHandler(asyncapiDocument, root, stats, next) {
    let fileNamesForSeparation = {};
    if (usesNewAPI(this.templateConfig)) {
      fileNamesForSeparation = {
        channel: convertCollectionToObject(asyncapiDocument.channels().all(), 'address'),
        message: convertCollectionToObject(asyncapiDocument.messages().all(), 'id'),
        securityScheme: convertCollectionToObject(asyncapiDocument.components().securitySchemes().all(), 'id'),
        schema: convertCollectionToObject(asyncapiDocument.components().schemas().all(), 'id'),
        objectSchema: convertCollectionToObject(asyncapiDocument.schemas().all().filter(schema => schema.type() === 'object'), 'id'),
        parameter: convertMapToObject(this.getAllParameters(asyncapiDocument)),
        everySchema: convertCollectionToObject(asyncapiDocument.schemas().all(), 'id'),
      };
    } else {
      const objectSchema = {};
      asyncapiDocument.allSchemas().forEach((schema, schemaId) => { if (schema.type() === 'object') objectSchema[schemaId] = schema; });
      fileNamesForSeparation = {
        channel: asyncapiDocument.channels(),
        message: convertMapToObject(asyncapiDocument.allMessages()),
        securityScheme: asyncapiDocument.components() ? asyncapiDocument.components().securitySchemes() : {},
        schema: asyncapiDocument.components() ? asyncapiDocument.components().schemas() : {},
        objectSchema,
        parameter: convertMapToObject(this.getAllParameters(asyncapiDocument)),
        everySchema: convertMapToObject(asyncapiDocument.allSchemas()),
      };
    }

    // Check if the filename dictates it should be separated
    let wasSeparated = false;
    for (const prop in fileNamesForSeparation) {
      if (Object.hasOwn(fileNamesForSeparation, prop) && stats.name.includes(`$$${prop}$$`)) {
        await this.generateSeparateFiles(asyncapiDocument, fileNamesForSeparation[prop], prop, stats.name, root);
        const templateFilePath = path.relative(this.templateContentDir, path.resolve(root, stats.name));
        fs.unlink(path.resolve(this.targetDir, templateFilePath), next);
        wasSeparated = true;
        //The filename can only contain 1 specifier (message, scheme etc)
        break;
      }
    }
    // If it was not separated process normally
    if (!wasSeparated) {
      await this.generateFile(asyncapiDocument, stats.name, root);
      next();
    }
  }
Makes sure that during directory structure generation ignored dirs are not modified
@private

@param  {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source.
@param  {String} objectMap Map of schemas of type object
@param  {String} root Dir name.
@param  {String} stats Information about the file.
@param  {Function} next Callback function