docs: function resolveDataSourceAttributes(resourceTree, dataSources, primaryName) {
      Object.keys(dataSources).forEach(dataSourceName => {
          const dataSource = dataSources[dataSourceName];
          dataSource.attributes = [];
          dataSource.attributeOptions = {};
      });
  
      resourceTree.attributes.forEach(function resolveAttribute(attrInfo) {
          let selectedDataSources;
  
          if (attrInfo.fromDataSource === '#same-group') {
              return attrInfo.attributes.forEach(resolveAttribute); // handle key-groups as flat
          }
  
          if (attrInfo.fromDataSource === '#all-selected') {
              attrInfo.attrNode.selectedDataSource = primaryName;
              selectedDataSources = [];
              Object.keys(dataSources).forEach(dataSourceName => {
                  if (dataSources[dataSourceName].joinParentKey) return;
                  selectedDataSources.push(dataSourceName);
              });
          } else if (attrInfo.fromDataSource === '#current-primary') {
              attrInfo.attrNode.selectedDataSource = primaryName;
              selectedDataSources = [attrInfo.attrNode.selectedDataSource];
          } else if (attrInfo.fromDataSource) {
              attrInfo.attrNode.selectedDataSource = attrInfo.fromDataSource;
              selectedDataSources = [attrInfo.attrNode.selectedDataSource];
          } else {
              attrInfo.attrNode.selectedDataSource = Object.keys(attrInfo.dataSourceMap).find(
                  dataSourceName => dataSources[dataSourceName]
              );
  
              if (!attrInfo.attrNode.selectedDataSource) {
                  throw new ImplementationError(
                      'No proper DataSource selected for attribute ' +
                          '(this should not happen - bug in request-resolver in Flora core)'
                  );
              }
              selectedDataSources = [attrInfo.attrNode.selectedDataSource];
          }
  
          selectedDataSources.forEach(selectedDataSourceName => {
              const attribute = attrInfo.dataSourceMap[selectedDataSourceName];
              dataSources[selectedDataSourceName].attributes.push(attribute);
              dataSources[selectedDataSourceName].attributeOptions[attribute] = _.pick(attrInfo.attrNode, [
                  'type',
                  'storedType',
                  'multiValued',
                  'delimiter'
              ]);
          });
  
          return null;
      });
  
      Object.keys(dataSources).forEach(dataSourceName => {
          dataSources[dataSourceName].attributes = _.uniq(dataSources[dataSourceName].attributes);
      });
  }