registerCommand(name, factory) {
        this.commandFactories.set(name, factory);
    }
Registers a command factory with a given name.

@param {string} name - The name to associate with the command factory.
@param {Function} factory - A function that returns a new instance of the command.

@description
This method allows registering command factories by name, enabling the creation of commands
using string identifiers. Registered commands can be executed by passing their name to the execute method.

@example
undoRedoManager.registerCommand('createUser', () => new CreateUserCommand());
undoRedoManager.execute('createUser'); // Creates and executes a new CreateUserCommand