 
     deferred.promise
 
-
   changeState: (publish = true, remove = false, filterFunction) ->
     deferred = Q.defer()
     @publishProducts = true

      _.find variants, (variant) =>
        variant.attributes or= []
        attribute = _.find variant.attributes, (attrib) =>
          console.log "A", attrib
          attrib.name is @customAttributeNameToMatch
        attribute?


          index = @slug2index[product.slug[GLOBALS.DEFAULT_LANGUAGE]] if product.slug? and product.slug[GLOBALS.DEFAULT_LANGUAGE]?
    return @existingProducts[index] if index > -1

  _matchOnCustomAttribute: (product) ->
    attribute = undefined
    if @customAttributeNameToMatch?
