createSnapshot() {
        const snapshot = {
            undoStack: this.undoStack.map(cmd => cmd.serialize()),
            redoStack: this.redoStack.map(cmd => cmd.serialize())
        };
        this.snapshots.set(this.undoStack.length, snapshot);
    }
Creates a snapshot of the current undo and redo stacks.

@description
This method creates a serialized snapshot of the current state of the undo and redo stacks.
The snapshot is stored in the snapshots Map, indexed by the current size of the undo stack.
Snapshots are used for recovery in case of errors during undo or redo operations.

@example
undoRedoManager.createSnapshot();