docs: function onDialogUpdate() {
      var pushOccupants = [],
          newDialogName = $('#dialog-name-input').val().trim(),
          toUpdate = {};
  
      $('#add_new_occupant .users_form.active').each(function(index) {
          pushOccupants[index] = $(this).attr('id').slice(0, -4);
      });
  
      if (currentDialog.name != newDialogName) {
          toUpdate.name = newDialogName;
      }
  
      if (pushOccupants.length > 0) {
          toUpdate.push_all = {
              occupants_ids: pushOccupants
          }
      }
  
      if (Object.keys(toUpdate).length == 0) {
          console.log("Nothing to update");
      } else {
          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);
                  bootbox.alert("Error while updating chat dialog: " + JSON.stringify(err));
  
              } else {
                  console.log("Dialog updated");
  
                  var dialogId = res._id;
                  dialogs[dialogId] = res;
  
                  currentDialog = res;
  
                  $('#' + res._id).remove();
  
                  showOrUpdateDialogInUI(res, true);
  
                  // notify new users about current video call
  
                  if (callIsInProgress && pushOccupants.length) {
                      var newOccupants = pushOccupants.map(function(id) {
                          return Number(id);
                      });
  
                      notifyOccupants(res.occupants_ids, dialogId, 2, newOccupants);
                  } else {
                      notifyOccupants(res.occupants_ids, dialogId, 2);
                  }
  
                  $('#' + res._id).removeClass('inactive').addClass('active');
              }
          });
      }
  
      $("#update_dialog").modal("hide");
      $('#dialog-name-input').val('');
      $('.users_form').removeClass("active");
  }