function buildNav(members) {

  var seen = {};
  var nav = navigationMaster;
  if (members.modules.length) {

    members.modules.forEach(function(m) {
      if (!hasOwnProp.call(seen, m.longname)) {

        nav.module.members.push(linkto(m.longname, m.longname.replace("module:", "")));
      }
      seen[m.longname] = true;
    });
  }

  if (members.externals.length) {

    members.externals.forEach(function(e) {
      if (!hasOwnProp.call(seen, e.longname)) {

        nav.external.members.push(linkto(e.longname, e.name.replace(/(^"|"$)/g, '')));
      }
      seen[e.longname] = true;
    });
  }

  if (members.classes.length) {

    members.classes.forEach(function(c) {
      if (!hasOwnProp.call(seen, c.longname)) {

        nav.class.members.push(linkto(c.longname, c.longname.replace("module:", "")));
      }
      seen[c.longname] = true;
    });

  }

  if (members.namespaces.length) {

    members.namespaces.forEach(function(n) {
      if (!hasOwnProp.call(seen, n.longname)) {

        nav.namespace.members.push(linkto(n.longname, n.longname.replace("module:", "")));
      }
      seen[n.longname] = true;
    });

  }

  if (members.mixins.length) {

    members.mixins.forEach(function(m) {
      if (!hasOwnProp.call(seen, m.longname)) {

        nav.mixin.members.push(linkto(m.longname, m.longname.replace("module:", "")));
      }
      seen[m.longname] = true;
    });

  }

  if (members.interfaces && members.interfaces.length) {

    members.interfaces.forEach(function(m) {
      if (!hasOwnProp.call(seen, m.longname)) {

        nav.interface.members.push(linkto(m.longname, m.longname.replace("module:", "")));
      }
      seen[m.longname] = true;
    });

  }

  if (members.tutorials.length) {

    members.tutorials.forEach(function(t) {

      nav.tutorial.members.push(tutoriallink(t.name));
    });

  }

  if (members.globals.length) {
    members.globals.forEach(function(g) {
      if (g.kind !== 'typedef' && !hasOwnProp.call(seen, g.longname)) {

        nav.global.members.push(linkto(g.longname, g.longname.replace("module:", "")));
      }
      seen[g.longname] = true;
    });

    // even if there are no links, provide a link to the global page.
    if (nav.global.members.length === 0) {
      nav.global.members.push(linkto("global", "Types"));
    }
  }

  var topLevelNav = [],apis =[];
  _.each(nav, function(entry, name) {
    if (entry.members.length > 0 && name !== "index" && name!="tutorial") {
      entry.members.forEach(function(c){
        apis.push( c )
      });
    }
  });
  topLevelNav.push(nav.customTutorials);
  topLevelNav.push(nav.customHowTos);
  topLevelNav.push(nav.tutorial);
  // topLevelNav.push(nav.cdn);
  // topLevelNav.push(nav.customTutorials);
    topLevelNav.push({
        title: "API",
        link: linkto("modules.list.html"),
        members: apis
      });
  nav.topLevelNav = topLevelNav;
}
Create the navigation sidebar.
@param {object} members The members that will be used to create the sidebar.
@param {array<object>} members.classes
@param {array<object>} members.externals
@param {array<object>} members.globals
@param {array<object>} members.mixins
@param {array<object>} members.interfaces
@param {array<object>} members.modules
@param {array<object>} members.namespaces
@param {array<object>} members.tutorials
@param {array<object>} members.events
@return {string} The HTML for the navigation sidebar.