static formatTree(tree, max, joins, parents) {

    max = Math.max(max | 0, 0);
    joins = joins || {};
    parents = parents || [];

    let depth = parents.length;

    return tree.map(item => {

      joins[parents.concat(item.data.name).join('__')] = (item.data.properties || [])
        .filter(p => p.type === 'property')
        .reduce((obj, p) => {
          obj[p.data.name] = p.data.value;
          return obj;
        }, {});

      if (!item.data.children) {

        return item.data.name;

      }

      if (!max || depth < max) {

        let nameObj = {};
        nameObj[item.data.name] = this.formatTree(
          item.data.children || [],
          max,
          joins,
          parents.concat(item.data.name)
        );

        return nameObj;

      } else {

        return null;

      }

    }).filter(item => item);

  }
Format a parsed syntax tree in a way that the Composer expects