       cat = _.find @currentCandidates, (candidate) ->
         candidate.externalId is category.externalId
       if cat
-        @logger.info "Found match with externalId '#{cat.externalId}'."
-        @addMapping category
+        @logger.info "Found match for externalId '#{cat.externalId}' with id '#{cat.id}'."
+        @addMapping cat
       else
         msg = "No match found for category with external id '#{category.externalId}'"
         @logger.info msg

    @currentCandidates = []

  addMapping: (category) ->
    @externalId2IdMap[category.externalId] = category.id

  initialize: (categories) ->

        else
          @apiClient.getByExternalIds [category.parent.id]
          .then (result) ->
            if result.body.count is 1
              category.parent.id = result.body.results[0].id
              resolve category
            else
