processCollectionItems = async (items = [], currentPath) => {
  for (const item of items) {
    if (item.type === 'folder') {
      // Create folder
      let sanitizedFolderName = sanitizeName(item?.filename || item?.name);
      const folderPath = path.join(currentPath, sanitizedFolderName);
      fs.mkdirSync(folderPath, { recursive: true });

      // Create folder.bru file if root exists
      if (item?.root?.meta?.name) {
        const folderBruFilePath = path.join(folderPath, 'folder.bru');
        if (item.seq) {
          item.root.meta.seq = item.seq;
        }
        const folderContent = await jsonToCollectionBru(
          item.root,
          true 
        );
        safeWriteFileSync(folderBruFilePath, folderContent);
      }

      // Process folder items recursively
      if (item.items && item.items.length) {
        await processCollectionItems(item.items, folderPath);
      }
    } else if (['http-request', 'graphql-request'].includes(item.type)) {
      // Create request file
      let sanitizedFilename = sanitizeName(item?.filename || `${item.name}.bru`);
      if (!sanitizedFilename.endsWith('.bru')) {
        sanitizedFilename += '.bru';
      }

      // Convert JSON to BRU format based on the item type
      let type = item.type === 'http-request' ? 'http' : 'graphql';
      const bruJson = {
        meta: {
          name: item.name,
          type: type,
          seq: typeof item.seq === 'number' ? item.seq : 1
        },
        http: {
          method: (item.request?.method || 'GET').toLowerCase(),
          url: item.request?.url || '',
          auth: item.request?.auth?.mode || 'none',
          body: item.request?.body?.mode || 'none'
        },
        params: item.request?.params || [],
        headers: item.request?.headers || [],
        auth: item.request?.auth || {},
        body: item.request?.body || {},
        script: item.request?.script || {},
        vars: {
          req: item.request?.vars?.req || [],
          res: item.request?.vars?.res || []
        },
        assertions: item.request?.assertions || [],
        tests: item.request?.tests || '',
        docs: item.request?.docs || ''
      };

      // Convert to BRU format and write to file
      const content = await jsonToBruV2(bruJson);
      safeWriteFileSync(path.join(currentPath, sanitizedFilename), content);
    }
  }
}
Recursively processes collection items to create files and folders

@param {Array} items - Collection items
@param {string} currentPath - Current directory path