 angular
   .module('impac.services.widgets', [])
-  .service 'ImpacWidgetsSvc', ($q, $http, $log, ImpacRoutes, ImpacMainSvc, ImpacDashboardsSvc, ImpacDeveloper) ->
+  .service 'ImpacWidgetsSvc', ($q, $http, $log, $timeout, ImpacRoutes, ImpacMainSvc, ImpacDashboardsSvc, ImpacDeveloper) ->
 
     _self = @
-
+# ====================================
+# Getters
+# ====================================
     # Simply forward the getter for objects that remain stored in other services
     @getSsoSessionId = ImpacMainSvc.getSsoSessionId
 
+
+# ====================================
+# Load and initialize
+# ====================================
     @load = (force=false) ->
       if !_self.getSsoSessionId()? || force
         $q.all([ImpacMainSvc.loadUserData(force), ImpacDashboardsSvc.load(force)])
       else
         $q.resolve()
-
-
-    @create = (opts) ->
-      deferred = $q.defer()
-
-      _self.load().then(
-        ->
-          dashboard = ImpacDashboardsSvc.getCurrentDashboard()
-          data = { widget: opts }
-
-          # form a http request or a stubbed request which returns a promise.
-          if ImpacDeveloper.isWidgetStubbed(data.widget)
-            request = ImpacDeveloper.createWidgetStub(data.widget, dashboard)
-          else
-            request = $http.post(ImpacRoutes.widgets.create(dashboard.id), data)
-
-          request.then(
-            (success) ->
-              newWidget = success.data
-              dashboard.widgets.push(newWidget)
-              ImpacDashboardsSvc.callbacks.widgetAdded.notify(newWidget)
-              deferred.resolve(newWidget)
-
-            (error) ->
-              $log.error("Impac! - WidgetsSvc: Cannot create widget on dashboard #{dashboard.id}")
-              deferred.reject(error)
-          )
-
-        (error) ->
-          $log.error("Impac! - WidgetsSvc: Error while trying to load the service")
-          deferred.reject(error)
-      )
-
-      return deferred.promise
 
 
     isWidgetInCurrentDashboard = (widgetId) ->

            deferred.reject("trying to load a widget (id: #{widget.id}) that is not in currentDashboard")

          else
            data = {
              owner: widget.owner
              sso_session: _self.getSsoSessionId()
              metadata: widget.metadata
              engine: widget.category
            }
            angular.extend(data, {refresh_cache: true}) if refreshCache

            dashboard = ImpacDashboardsSvc.getCurrentDashboard()


          )
      )

# ====================================
# CRUD methods
# ====================================

    @show = (widget, refreshCache=false) ->
      deferred = $q.defer()
