docs: function onDialogUpdate() {
    var pushOccupants  = [];
    $('#add_new_occupant .users_form.active').each(function(index) {
      pushOccupants[index] = $(this).attr('id').slice(0, -4);
    });
  
    var dialogName  = $('#dialog-name-input').val().trim();
  
    var toUpdate = {
        name:     dialogName,
        push_all: {occupants_ids: pushOccupants}
      };
  
    console.log("Updating the dialog with params: " + JSON.stringify(toUpdate));
  
    QB.chat.dialog.update(currentDialog._id, toUpdate, function(err, res) {
      if (err) {
        console.log(err);
      } else {
        console.log("Dialog updated");
  
        var dialogId = res._id;
        dialogs[dialogId] = res;
  
        currentDialog = res;
  
        $('#'+res._id).remove();
  
        showOrUpdateDialogInUI(res, true);
  
        notifyOccupants(res.occupants_ids, dialogId, 2);
  
        $('#'+res._id).removeClass('inactive').addClass('active');
      }
    });
  
    $("#update_dialog").modal("hide");
    $('#dialog-name-input').val('');
    $('.users_form').removeClass("active");
  }