code: function updateUserTone(assistantPayload, toneAnalyzerPayload, maintainHistory) {
    if (typeof assistantPayload.context === 'undefined') {
      assistantPayload.context = {};
    }
  
    if (typeof assistantPayload.context.user === 'undefined') {
      assistantPayload.context = initUser();
    }
  
    // For convenience sake, define a variable for the user object
    var user = assistantPayload.context.user;
  
    // Extract the document-level tones
    if (toneAnalyzerPayload && toneAnalyzerPayload.document_tone) {
      updateTone(user, toneAnalyzerPayload.document_tone.tones, maintainHistory);
    }
  
    assistantPayload.context.user = user;
  
    return assistantPayload;
  }
docs: updateUserTone processes the Tone Analyzer payload to identify the most significant tone
  (i.e., the tone with the largest score). The assistantPayload json object is updated
  to include these tones.
  @param assistantPayload json object returned by the Watson assistant Service
  @param toneAnalyzerPayload json object returned by the Watson Tone Analyzer Service
  @return assistantPayload where the user object has been updated with tone information from the toneAnalyzerPayload