protected virtual SiteRoute[] MapDatedRoutes(string name, string urlWithoutBase, object defaults, object constraints, MapRouteModes modes)
 {
   return new[] { MapRoute(name, urlWithoutBase, defaults, constraints, modes | MapRouteModes.NeedsBase | MapRouteModes.NonDated, DefaultMerit)
   , MapRoute(name + "Dated", "/{year}/{month}/{day}" + urlWithoutBase, defaults, constraints, modes | MapRouteModes.NeedsBase | MapRouteModes.Dated, DefaultMerit)};
 }
 protected virtual SiteRoute MapRoute(string routeName, string url, object defaults, MapRouteModes modes)
 {
   return MapRoute(routeName, url, defaults, null, modes, DefaultMerit);
 }
    protected virtual SiteRoute MapRoute(string routeName, string url, object defaults, object constraints, MapRouteModes modes, int merit)
    {
      var dataTokens = new RouteValueDictionary();
      var defaultsDict = defaults == null ? new RouteValueDictionary() : new RouteValueDictionary(defaults);
      var constraintsDict = defaults == null ? new RouteValueDictionary() : new RouteValueDictionary(constraints);

      if ((modes & MapRouteModes.Secure) == MapRouteModes.Secure)
        dataTokens.Add("Secure", true);

      if ((modes & MapRouteModes.NeedsBase) == MapRouteModes.NeedsBase)
        url = BasePath + url;

      //allow collection plugin routes to be constrained to just the collections they are activated for
      if (url.Contains("{collection}") && !constraintsDict.ContainsKey("collectionIds"))
      {
        constraintsDict.Add("collectionIds",
          (modes & MapRouteModes.Dated) == MapRouteModes.Dated ? GetDatedCollectionConstraint() :
          (modes & MapRouteModes.NonDated) == MapRouteModes.NonDated ? GetNonDatedCollectionConstraint() :
          GetCollectionConstraint()
          );
      }

      //add restricted path keywords to constraint 
      //HACK: this is currently a hack needed due to inability to
      //insert routes
      //TODO: we can now insert routes, go back and fix this hack
      if (url.Contains("{path}") && !constraintsDict.ContainsKey("path"))
      {
        constraintsDict.Add("path", new PathRouteConstraint()); 
      }

      SetDataTokens(dataTokens);
      System.Web.Routing.Route r = new System.Web.Routing.Route(url, defaultsDict, constraintsDict, dataTokens, new MvcRouteHandler());
      var siteRoute = new SiteRoute() { Merit = merit, Name = routeName, Route = r };
      Routes.AddRoute(siteRoute, merit);
      return siteRoute;
    }