title: Delete All Record and Create new Records in Emberjs
body: <p>In my Controller i have open action.this action should remove all record of model and then send ajax request and get new models and replace model. my ember data adapter is <a href="https://github.com/rpflorence/ember-localstorage-adapter" rel="nofollow">LSA</a></p>
  
  <pre><code>OlapApp.OpenController = Ember.Controller.extend({
  needs: ['application'],
  actions: {
      open: function() {
          var self = this;
          var xhr = $.ajax({
              type: 'POST',
              dataType: 'json',
              contentType: 'application/json',
              url: 'http://localhost:9095/service.asmx/getModel',
              data: '{}',
              success: function(response) {
                  //Success Empty AxisModel;
                  var data = JSON.parse(response.d);
                  self.store.findAll('axisModel').then(function(items) {
                      console.log('try to delete');
                      items.forEach(function(item) {
                          item.deleteRecord();
                          item.save();
                      });
                  });
  
                  setTimeout(function() {
                      //Fill Axis Model
                      _.each(data.axisModel, function(v, i) {
                          var record = self.store.createRecord('axisModel', {
                              id: v["id"],
                              uniqueName: v["uniqueName"],
                              name: v["name"],
                              hierarchyUniqueName: v.hierarchyUniqueName,
                              type: v["type"],
                              isMeasure: v.isMeasure,
                              orderId: v.orderId,
                              isActive: v.isActive,
                              isAll: v.isAll,
                              sort: v.sort
                          });
                          record.save();
                      });
                      self.get('controllers.application').send('showNotification',     'Open', 'success');
  
                  }, 2000);
              }
          });
      }
  }
  });
  </code></pre>
  
  <p>but when i try to create a new models i get this error : </p>
  
  <pre><code>Assertion failed: The id a12 has already been used with another record of type OlapApp.AxisModel. 
  Assertion failed: The id a13 has already been used with another record of type OlapApp.AxisModel. 
  </code></pre>
  
  <hr>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>finally i find the solution.for fix this problem just wrap deleteRecord() in Ember.run.once like this :</p>
  
  <pre><code>self.store.findAll('axisModel').then(function(items) {
                      items.forEach(function(item){
                            Ember.run.once(function(){
                             item.deleteRecord();
                           item.save();
                           });
                      });
                  });
  </code></pre>