                         error: =>
                             deferred.resolve()
 
+        addServices: (services) ->
+            sm.resolveImmediately()
+
         setService: (service) ->
             @services.set []
             @addService service

    'backbone.marionette',
    'URI',
    'cs!app/base',
    'cs!app/models'
],
(
    $,
    Marionette,
    URI,
    sm,
    Models
) ->

    PAGE_SIZE = appSettings.page_size

                sm.resolveImmediately()

        renderUnitsByServices: (serviceIdString, queryParameters) ->
            municipalityIds = queryParameters?.municipality?.split ','

            serviceIds = serviceIdString.split ','
            services = _.map serviceIds, (id) -> new models.Service id: id

            serviceDeferreds = _.map services, (service) ->
                return sm.withDeferred (deferred) ->
                    service.fetch
                        data: include: 'ancestors'
                        success: -> deferred.resolve(service)
                        error: -> deferred.fail()

            deferreds = _.map services, -> $.Deferred()
            $.when(serviceDeferreds...).done (serviceObjects...) =>
                _.each serviceObjects, (srv, idx) =>
                    # trackCommand needs to be called manually since
                    # commands don't return promises so
                    # we need to call @addService directly
                    Analytics.trackCommand 'addService', [srv]
                    @addService(srv, municipalityIds).done ->
                        deferreds[idx].resolve()
            return $.when deferreds...

        _fetchDivisions: (divisionIds, callback) ->
