         if _.has email2id, customer.email
           # TODO: support updating of customers
           posts.push Q('Update of customer is not implemented yet!')
+          @taskQueue.addTask _.bind(@update, this, customer, customer.email, email2id[customer.email])
         else
           posts.push @taskQueue.addTask _.bind(@create, this, customer, paymentInfo)
 

      deferred.reject "deferred.promise: #{err}"
    .done()
    deferred.promise

  create: (newCustomer, paymentInfo) ->
    deferred = Q.defer()

      existingCustomers = result.results
      email2id = {}
      for ec in existingCustomers
        email2id[ec.email] = ec
      console.log "Existing customers: " + _.size(email2id)

      posts = []
