Creating resource on the fly when we want to delete model created by WS events

Change-Id: I2e5c0e0af2be6366d86437d140d4517990940cbb
diff --git a/src/app/datasources/stores/model.store.spec.ts b/src/app/datasources/stores/model.store.spec.ts
index dfe0d24..a6edcb9 100644
--- a/src/app/datasources/stores/model.store.spec.ts
+++ b/src/app/datasources/stores/model.store.spec.ts
@@ -7,6 +7,7 @@
 import {StoreHelpers} from '../helpers/store.helpers';
 import {ModelRest} from '../rest/model.rest';
 import {AppConfig} from '../../config/app.config';
+import {ModelHelpers} from '../../core/services/helpers/model.helper';
 
 let service: IModelStoreService;
 let httpBackend: ng.IHttpBackendService;
@@ -40,7 +41,8 @@
       .service('WebSocket', MockWs)
       .service('StoreHelpers', StoreHelpers) // TODO mock
       .service('ModelRest', ModelRest) // TODO mock
-      .service('ModelStore', ModelStore);
+      .service('ModelStore', ModelStore)
+      .service('ModelHelpers', ModelHelpers); // TODO mock
 
     angular.mock.module('ModelStore');
   });
diff --git a/src/app/datasources/stores/model.store.ts b/src/app/datasources/stores/model.store.ts
index 903bd46..015d729 100644
--- a/src/app/datasources/stores/model.store.ts
+++ b/src/app/datasources/stores/model.store.ts
@@ -4,18 +4,20 @@
 import {IWSEvent, IWSEventService} from '../websocket/global';
 import {IXosResourceService} from '../rest/model.rest';
 import {IStoreHelpersService} from '../helpers/store.helpers';
+import {IXosModelHelpersService} from '../../core/services/helpers/model.helper';
 
 export interface  IModelStoreService {
   query(model: string): Observable<any>;
 }
 
 export class ModelStore {
-  static $inject = ['WebSocket', 'StoreHelpers', 'ModelRest'];
+  static $inject = ['WebSocket', 'StoreHelpers', 'ModelRest', 'ModelHelpers'];
   private _collections: any; // NOTE contains a map of {model: BehaviourSubject}
   constructor(
     private webSocket: IWSEventService,
     private storeHelpers: IStoreHelpersService,
-    private ModelRest: IXosResourceService
+    private ModelRest: IXosResourceService,
+    private ModelHelpers: IXosModelHelpersService
   ) {
     this._collections = {};
   }
@@ -42,7 +44,7 @@
 
   private loadInitialData(model: string) {
     // NOTE check what is the correct pattern to pluralize this
-    const endpoint = `/core/${model.toLowerCase()}s`;
+    const endpoint = this.ModelHelpers.urlFromCoreModel(model);
     this.ModelRest.getResource(endpoint).query().$promise
       .then(
         res => {