text: var _ = require("underscore");
  
  
  
  
  var FeedSite = function(){
      var self = this;
  
      this.init = function(jsonData){
          this.id = jsonData.id;
          this.title = jsonData.title;
          this.unreadCount = jsonData.unreadCount;
          this.domain = jsonData.domain;
  
      }
  
      this.markAllRead = function(){
          // some api
      }
  
  
  
      return this;
  }
  
  
  
  
  var FeedSiteList = function(){
      var feedSiteList = [];
  
  
  
      this.addFeedSite = function(feedSite){
          var fs = this.getFeedSiteById(feedSite.id);
          if(fs == null){
              feedSiteList.push(feedSite);
          }
  
      }
  
      this.removeFeedSite = function(feedSite){
          // compare id
      }
  
      this.getFeedSiteById = function(feedSiteId){
          return _.find(feedSiteList, function(x){ return x.id===feedSiteId });
      }
  
      this.render = function(tpl){
          return tpl(sites=feedSiteList);
      }
  
      this.totalUnreadCount = function(){
          // use underscore
          return _(feedSiteList).map(function(x){return x.unreadCount})
                                .reduce(function(a,b){return a+b}, 0);
      }
  
  
  
  
  }
  
  
  
  exports.FeedSite = FeedSite;
  exports.FeedSiteList = FeedSiteList;
  
  
  
  
  
  
  
  