for saving packages info to state
function setPackagesState(app, dependencies, cb) {
  var zealPacks = {};
  let promises = [];

  _.forEach(dependencies, function(val, key) {
    buildPackagesList(app, zealPacks, val, key, promises);
  });
  /* app.debug('Installed themes: %O', app.locals.themes);
  app.debug('Installed apps: %O', app.locals.apps); */
  Promise.all(promises).then(() => {
    app.emit('zealder packages loaded');

    // if callback passed
    if (cb) cb(zealPacks);
  });
}