title: How do I delete models from a backbone.js localStorage collection properly
body: <p>I am using backbone-localstorage plugin for caching data from server. I am using jquery ajax to manually fetch data from the server and then add to the backbone collection.
  Each time the page is loaded I remove the existing data from the local storage and then load fresh data from server.</p>
  
  <p>I am using the following code :</p>
  
  <pre><code>success : function(response){
              var json = $.parseJSON(response);
              var channelList = new NewsApp.channelCollection();
              channelList.localStorage = new Backbone.LocalStorage("channellist");
              channelList.fetch();
  
              //Clear the current items from the localStorage so as not to exceed the localstorage limit
              channelList.each(function(model) {
                  console.log("Channel Removed");
                  model.destroy();
              } );
  
              _.each(json.channel, function(channel){
                  channelList.create(channel);
              });
  
              console.log(channelList);
  }
  </code></pre>
  
  <p>This works fine the first time I run it. But when I run it the second time, <strong>some</strong> of the models from the last execution still persist in the collection.</p>
  
  <p>Is this the proper method for inserting and removing data from the backbone localstorage ?</p>