docs: function populateModelsWithLocalData(app, YAMLfiles, apicCfg, dir, uid, cb) {
    logger.debug('populateModelsWithLocalData entry');
  
    //default organization
    var defaultOrg = {
      id: 'defaultOrgID',
      name: 'defaultOrgName',
      title: 'defaultOrgTitle' };
  
    //default catalog
    var defaultCatalog = {
      id: 'defaultCatalogID',
      name: 'defaultCatalogName',
      title: 'defaultCatalogTitle' };
    defaultCatalog.organization = defaultOrg;
  
    //the apis
    var apis = {};
  
    async.series([
      // 1. create the "api" instances
      function(seriesCallback) {
        async.forEach(YAMLfiles,
          function(file, fileCallback) {
            logger.debug('Loading data from %s', file);
            var readfile;
            try {
              // read the content of the files into memory and parse as JSON
              readfile = YAML.load(fs.readFileSync(file, 'utf8'));
  
            } catch (e) {
              fileCallback(e);
              return;
            }
            var model = {};
            var entry = {};
            // looks like a product
            if (readfile.product) {
              logger.debug('product found: skipping');
            }
            // looks like an API
            if (readfile.swagger) {
              entry.id = createAPIID(readfile);
              entry.document = expandAPIData(readfile, dir);
              if (entry.document) {
                model.name = 'api';
                if (entry.document.info['x-ibm-name']) {
                  apis[entry.document.info['x-ibm-name']] = entry.document;
                } else {
                  apis[entry.document.info['title']] = entry.document;
                }
              }
            }
  
            if (model.name) {
              // no catalog
              entry.catalog = {};
              entry['snapshot-id'] = uid;
              app.models[model.name].create(
                entry,
                function(err, mymodel) {
                  if (err) {
                    logger.error(err);
                    fileCallback(err);
                    return;
                  }
                  logger.debug('%s created: %j', model.name, mymodel);
                  fileCallback();
                });
            } else {
              fileCallback();
            }
          },
          function(err) {
            if (err) { /* suppress eslint handle-callback-err */ }
          }
        );
        seriesCallback();
      },
      // 2. create the "catalog" instances
      function(seriesCallback) {
        defaultCatalog['snapshot-id'] = uid;
        app.models['catalog'].create(
          defaultCatalog,
          function(err, mymodel) {
            if (err) {
              logger.error(err);
              seriesCallback(err);
              return;
            }
            logger.debug('%s created: %j', 'catalog', mymodel);
            seriesCallback();
          });
      },
      // 3. create one "product" with all the apis defined
      function(seriesCallback) {
        var entry = {};
        // add catalog
        entry.catalog = defaultCatalog;
        entry['snapshot-id'] = uid;
  
        entry.document = {
          product: '1.0.0',
          info: {
            name: 'static-product',
            version: '1.0.0',
            title: 'static-product' },
          visibility: {
            view: {
              type: 'public' },
            subscribe: {
              type: 'authenticated' } },
          apis: apis };
  
        var rateLimit = '100/hour';
        if (process.env[LAPTOP_RATELIMIT]) {
          rateLimit = process.env[LAPTOP_RATELIMIT];
        }
  
        if (apicCfg && apicCfg.plans && apicCfg.applications) {
          //add the configured plans
          entry.document.plans = {};
          //add plan and its APIs
          for (var p in apicCfg.plans) {
            var plan = apicCfg.plans[p];
            if (typeof plan === 'object') {
              var planApis = {};
              for (var i in plan.apis) {
                var name = plan.apis[i];
                //add the api to plan if only if the api does exist
                if (apis[name]) {
                  planApis[name] = {};
                } else {
                  logger.warn('Cannot add the invalid api "%s" to plan "%s"',
                          name, p);
                }
              }
              entry.document.plans[p] = {
                apis: planApis,
                'rate-limit': {
                  value: plan['rate-limit'] || rateLimit,
                  'hard-limit': plan['hard-limit'] } };
            }
          }
        } else {
          //the default plan
          entry.document.plans = {
            default: {
              apis: apis,
              'rate-limit': {
                value: rateLimit,
                'hard-limit': true } } };
        }
  
        if (logger.debug()) {
          logger.debug('creating static product and attaching apis to plans: %s',
                  JSON.stringify(entry, null, 2));
        }
  
        app.models.product.create(
          entry,
          function(err, mymodel) {
            if (err) {
              logger.error(err);
              seriesCallback(err);
              return;
            }
            logger.debug('%s created: %j', 'product', mymodel);
            seriesCallback();
          });
      },
      // 4. create the "subscriptions" instances
      function(seriesCallback) {
        var subscriptions = [];
        if (apicCfg && apicCfg.plans && apicCfg.applications) {
          //add the configured plans
          var idx = 0;
          for (var k in apicCfg.applications) {
            var theApp = apicCfg.applications[k];
            //An application can subscribe only one plan in a given product. Since
            //we have only one product defined for local data, the subscription of
            //an app should be a string instead of array!
            if (theApp && (!theApp.subscription || typeof theApp.subscription !== 'string')) {
              logger.warn('The app "%s" does not subscribe a plan?', k);
            } else if (typeof theApp === 'object') {
              subscriptions[idx] = {
                'snapshot-id': uid,
                organization: defaultOrg,
                'developer-organization': defaultOrg,
                catalog: defaultCatalog,
                id: 'defaultSubsID-' + k + '-static-product',
                application: {
                  id: 'defaultAppID-' + k,
                  title: 'defaultAppTitle-' + idx,
                  'oauth-redirection-uri': (theApp['oauth-redirection-uri'] || 'https://localhost'),
                  'app-credentials': [ {
                    'client-id': k,
                    'client-secret': (theApp['client-secret'] || 'dummy') } ] },
                'plan-registration': {
                  id: ('static-product:1.0.0:' + theApp.subscription) } };
            }
            idx++;
          }
        } else {
          //the default subscription
          subscriptions[0] = {
            'snapshot-id': uid,
            organization: defaultOrg,
            'developer-organization': defaultOrg,
            catalog: defaultCatalog,
            id: 'defaultSubsID',
            application: {
              id: 'defaultAppID',
              title: 'defaultAppTitle',
              'oauth-redirection-uri': 'https://localhost',
              'app-credentials': [ {
                'client-id': 'default',
                'client-secret': 'CRexOpCRkV1UtjNvRZCVOczkUrNmGyHzhkGKJXiDswo=' } ] },
            'plan-registration': {
              id: 'ALLPLANS' } };
        }
  
        async.forEach(
          subscriptions,
          function(subscription, subsCallback) {
            var modelname = 'subscription';
            app.models[modelname].create(
              subscription,
              function(err, mymodel) {
                if (err) {
                  logger.error(err);
                  subsCallback(err);
                  return;
                }
                logger.debug('%s created: %j', modelname, mymodel);
                subsCallback();
              });
          });
        seriesCallback();
      },
  
      // 5. create the "tls-profile" instances
      function(seriesCallback) {
        var modelname = 'tlsprofile';
        async.forEachOf(
          apicCfg['tls-profiles'],
          function(profile, name, asyncCB) {
            var instance = {
              'snapshot-id': uid,
              'org-id': defaultOrg.id,
              id: 'defaultTlsProfile-' + name,
              name: name,
              public: false,
              ciphers: [
                'SSL_RSA_WITH_AES_256_CBC_SHA',
                'SSL_RSA_WITH_AES_128_CBC_SHA',
                'SSL_RSA_WITH_3DES_EDE_CBC_SHA',
                'SSL_RSA_WITH_RCA_128_SHA',
                'SSL_RSA_WITH_RCA_128_MD5' ],
              protocols: [ 'TLSv11', 'TLSv12' ],
              certs: [],
              'mutual-auth': false };
  
            if (profile.rejectUnauthorized === true) {
              instance['mutual-auth'] = true;
            }
  
            if (Array.isArray(profile.secureProtocols)) {
              instance.protocols = [];
              profile.secureProtocols.forEach(function(protocol) {
                switch (protocol) {
                  case 'TLSv1_method':
                    instance.protocols.push('TLSv1');
                    break;
                  case 'TLSv1_1_method':
                    instance.protocols.push('TLSv11');
                    break;
                  case 'TLSv1_2_method':
                    instance.protocols.push('TLSv12');
                    break;
                }
              });
            }
  
            if (typeof profile.key === 'object') {
              instance['private-key'] = profile.key.content;
            }
  
            if (typeof profile.cert === 'object') {
              instance.certs.push({
                name: profile.cert.name,
                cert: profile.cert.content,
                'cert-type': 'INTERMEDIATE',
                'cert-id': name + '-cert-' + profile.cert.name });
            }
  
            if (Array.isArray(profile.ca)) {
              profile.ca.forEach(function(ca) {
                if (typeof ca === 'object') {
                  instance.certs.push({
                    name: ca.name,
                    cert: ca.content,
                    'cert-type': 'CLIENT',
                    'cert-id': name + '-ca-cert-' + ca.name });
                }
              });
            }
  
            app.models[modelname].create(
              instance,
              function(err, mymodel) {
                if (err) {
                  logger.error('Failed to populate a tls-profile:', err);
                } else {
                  logger.debug('%s created: %j', modelname, mymodel);
                }
                asyncCB();
              });
          });
  
        seriesCallback();
      } ],
      function(err) { cb(err); });
  }