constructResoureTree = function (fileIdToLuResourceMap, triggerRules) {
  let resources = []
  let fileIdsFromInput = Array.from(fileIdToLuResourceMap.keys())
  let lowerCasefileIdsFromInput = Array.from(fileIdToLuResourceMap.keys()).map(x => x.toLowerCase())
  let triggerKeys = Object.keys(triggerRules)
  let lowerCaseTriggerKeys = triggerKeys.map(x => x.toLowerCase())

  for (const fileId of fileIdsFromInput) {
    let luResource = fileIdToLuResourceMap.get(fileId)
    let resource = {
      id: fileId,
      content: luResource,
      children: []
    }

    if (!lowerCaseTriggerKeys.includes(fileId.toLowerCase())) {
      resources.push(resource)
      continue
    }

    let intents = []
    for (const section of luResource.Sections) {
      if (section.SectionType === LUSectionTypes.SIMPLEINTENTSECTION
        || section.SectionType === LUSectionTypes.NESTEDINTENTSECTION) {
        intents.push(section)
      }
    }

    const intentToDestLuFiles = triggerRules[triggerKeys.find(k => k.toLowerCase() === fileId.toLowerCase())]
    for (const triggerIntent of Object.keys(intentToDestLuFiles)) {
      if (triggerIntent !== '' && !intents.some(i => i.Name === triggerIntent)) {
        throw (new exception(retCode.errorCode.INVALID_INPUT, `Sorry, trigger intent '${triggerIntent}' is not found in lu file: ${fileId}`))
      }

      let destLuFiles = intentToDestLuFiles[triggerIntent]
      if (typeof destLuFiles === 'string') destLuFiles = [destLuFiles]

      if (destLuFiles.length > 0) {
        destLuFiles.forEach(destLuFile => {
          if (destLuFile !== '' && !lowerCasefileIdsFromInput.includes(destLuFile.toLowerCase())) {
            throw (new exception(retCode.errorCode.INVALID_INPUT, `Sorry, lu file '${destLuFile}' is not found`))
          } else {
            resource.children.push({
              target: fileIdsFromInput.find(x => x.toLowerCase() === destLuFile.toLowerCase()) || '',
              intent: triggerIntent
            })
          }
        })
      } else {
        resource.children.push({
          target: '',
          intent: triggerIntent
        })
      }
    }

    resources.push(resource)
  }

  return resources
}
Contruct resource tree to build the father-children relationship among lu files
@param {Map<string, LUResource>} fileIdToLuResourceMap Map of file id and luResource
@param {any} triggerRules trigger rules object that indicate the triggering rules from root to dest lu files
@returns {any[]} object array of LUResource with id and children properties 
@throws {exception} throws errors