 
 
   _ensureProductTypeInMemory: (productTypeId) =>
-    @logger.info "ensuring product type id: #{productTypeId}"
     if @_cache.productType[productTypeId]
       Promise.resolve()
     else
-      console.log 'product type not in cache... resolving...'
       productType =
         id: productTypeId
       @_resolveReference(@client.productTypes, 'productType', productType, "name=\"#{productType?.id}\"")

  #   productTypeId: [{updateAction},{updateAction},...]
  # }
  _filterUniqueUpdateActions: (updateActions) =>
    @logger.info 'filtering unique update actions ->'
    console.log JSON.stringify(updateActions, null, 2)
    uniqueUpdateActions = {}
    _.each _.keys(updateActions), (productTypeId) =>
      actions = updateActions[productTypeId]
      uniqueActions = @commonUtils.uniqueObjectFilter actions
      uniqueUpdateActions[productTypeId] = uniqueActions
    console.log JSON.stringify(uniqueUpdateActions, null, 2)
    uniqueUpdateActions

  _objectFilter: (objCollection) =>
    uniques = []
    _.each objCollection, (obj) =>
      if not @_isObjectPresentInArray(uniques, obj) then uniques.push(obj) else console.log 'duplicate found'
    uniques


  _isObjectPresentInArray: (array, object) ->
    present = false
    _.each array, (element) ->
      if _.isEqual(object, element)
        present = true
    present

  _ensureProductTypesInMemory: (products) =>
    Promise.map products, (product) =>

              @logger.warn "Found more than 1 #{refKey} for #{ref.id}"
            @_cache[refKey][ref.id] = result.body.results[0]
            if refKey is 'productType'
              @_cache[refKey][result.body.results[0].id] = result.body.results[0]
            resolve(result.body.results[0].id)

