detectArrayChanges(newArray, oldArray = []) {
      Logger.debug(`Detecting changes between arrays`);
      const changes = {
        added: [],
        removed: [],
        moved: []
      };
      for (let i3 = 0; i3 < newArray.length; i3++) {
        const item = newArray[i3];
        const oldIndex = oldArray.findIndex(
          (oldItem) => JSON.stringify(oldItem) === JSON.stringify(item)
        );
        if (oldIndex === -1) {
          changes.added.push({ index: i3, item });
        } else if (oldIndex !== i3) {
          changes.moved.push({ oldIndex, newIndex: i3, item });
        }
      }
      for (let i3 = 0; i3 < oldArray.length; i3++) {
        const item = oldArray[i3];
        const newIndex = newArray.findIndex(
          (newItem) => JSON.stringify(newItem) === JSON.stringify(item)
        );
        if (newIndex === -1) {
          changes.removed.push({ index: i3, item });
        }
      }
      Logger.debug(`Detected changes:`, changes);
      return changes;
    }
Detects changes between two arrays, identifying items that were added, removed,
or moved. This function compares items by their JSON stringified values.

@param {Array} newArray - The new array to compare.
@param {Array} [oldArray=[]] - The old array to compare against. Defaults to an empty array.

@returns {Object} An object containing the changes between the arrays.