define(
  [
    'underscore',
    'stores/Store',
    'collections/IdentityCollection',
    'dispatchers/AppDispatcher'
  ],
  function(_, Store, IdentityCollection, AppDispatcher) {

    var _identities = null;
    var _isFetching = false;

    //
    // CRUD Operations
    //

    var fetchIdentities = function() {
      if(!_isFetching) {
        _isFetching = true;
        var identities = new IdentityCollection();
        identities.fetch().done(function () {
          _isFetching = false;
          _identities = identities;
          IdentityStore.emitChange();
        });
      }
    };

    //
    // Identity Store
    //

    var IdentityStore = {
      getAll: function() {
        if(!_identities) {
          fetchIdentities()
        }
        return _identities;
      },

      get: function (modelId) {
        if(!_identities) {
          fetchIdentities()
        }else {
          return _identities.get(modelId);
        }
      },

      getIdentityFor: function(provider){
        if(!_identities) return fetchIdentities();

        var identity = _identities.find(function(identity){
          return identity.get('provider').id === provider.id;
        });

        return identity;
      }
    };

    AppDispatcher.register(function(payload) {
      var action = payload.action;
      switch(action.actionType) {
        // add actions here
      }

      return true;
    });

    _.extend(IdentityStore, Store);

    return IdentityStore;

  });

@@ -4,17 +4,47 @@
 ine(
-%0A  %5B%0A    
+function(require) %7B%0A%0A  var _ = require(
 'und
@@ -55,943 +55,231 @@
 ore'
+)
 ,%0A    
-'stores/Store',%0A    'collections/IdentityCollection',%0A    'dispatchers/AppDispatcher'%0A  %5D,%0A  function(_, Store, IdentityCollection, AppDispatcher) %7B%0A%0A    var _identities = null;%0A    var _isFetching = false;%0A%0A    //%0A    // CRUD Operations%0A    //%0A%0A    var fetchIdentities = function() %7B%0A      if(!_isFetching) %7B%0A        _isFetching = true;%0A        var identities = new IdentityCollection();%0A        identities.fetch().done(function () %7B%0A          _isFetching = false;%0A          _identities = identities;%0A          IdentityStore.emitChange();%0A        %7D);%0A      %7D%0A    %7D;%0A%0A    //%0A    // Identity Store%0A    //%0A%0A    var IdentityStore = %7B%0A      getAll: function() %7B%0A        if(!_identities) %7B%0A          fetchIdentities()%0A        %7D%0A        return _identities;%0A      %7D,%0A%0A      get: function (modelId) %7B%0A        if(!_identities) %7B%0A          fetchIdentities()%0A        %7Delse %7B%0A          return _identities.get(modelId);%0A        %7D%0A      %7D,%0A%0A  
+  BaseStore = require('stores/BaseStore'),%0A      IdentityCollection = require('collections/IdentityCollection'),%0A      AppDispatcher = require('dispatchers/AppDispatcher');%0A%0A  var IdentityStore = BaseStore.extend(%7B%0A%0A
     
@@ -324,48 +324,47 @@
     
-  
 if(!
-_identities) return fetchIdentitie
+this.models) return this.fetchModel
 s();
@@ -367,26 +367,24 @@
 s();%0A%0A      
- 
- 
 var identity
@@ -390,18 +390,18 @@
 y = 
-_identitie
+this.model
 s.fi
@@ -423,18 +423,16 @@
 ntity)%7B%0A
-  
         
@@ -489,25 +489,21 @@
 ;%0A      
- 
- 
 %7D);%0A%0A
-  
       re
@@ -525,267 +525,95 @@
     
-  %7D%0A    %7D;%0A%0A    AppDispatcher.register(function(payload) %7B%0A      var action = payload.action;%0A      switch(action.actionType) %7B%0A        // add actions here%0A      %7D%0A%0A      return true;%0A    %7D);%0A%0A    _.extend(IdentityStore, Store);%0A%0A    return IdentityStore;%0A
+%7D%0A%0A  %7D);%0A%0A  return new IdentityStore(null, %7B%0A    collection: IdentityCollection
 %0A  %7D);%0A
+%0A%7D);%0A

refactor identity store to use base store