Refactor this whole C# class like I have started with "SetupCommonTransitions"

Let me explain to you how my app works it's default mode is called Tagomat a tagomat is an airport kiosk that scans boarding passes and prints bag tags, the default tagomat has a scanner and one or multiple printers. we also have models with optional features such as passport scanning, measurement and weighing. then we have a bagomat, the pax uses it to scan a bag tag, and the bagomat delivers the bag. the tagomat can now be configured to run both tagomat and bagomat on one kiosk, this is called one step. now that you know this, you will be able to split this in a better way.

using System.Diagnostics.CodeAnalysis;
using no.bbc.StateMachine;
using no.bbc.tagomat.Models;

namespace no.bbc.tagomat.StateMachine.Application;

[SuppressMessage("ReSharper", "UnusedParameter.Local")]
public class ApplicationStateMachine : StateMachine<ApplicationState, ApplicationInput>
{
    #region Private Fields

    private IApplicationStateMachineDelegate _delegate;
    private TagomatConfig _tagomatConfig;

    #endregion

    #region Private Properties

    private bool BagomatEnabled => _tagomatConfig.BagomatConfig?.Enabled ?? false;
    private bool BagomatOneStepModeEnabled => BagomatEnabled && (_tagomatConfig.BagomatConfig?.OneStepMode ?? false);
    private bool ScaleEnabled => _tagomatConfig.ScaleConfig?.Enabled == true;
    private bool MeasuringEnabled => _tagomatConfig.MeasureConfig?.Enabled == true;
    private bool PassportReaderEnabled => _tagomatConfig.PassportReaderConfig?.Enabled == true;
    private bool PaymentEnabled => _tagomatConfig.PaymentConfig?.Enabled == true;

    #endregion

    public ApplicationStateMachine(IApplicationStateMachineDelegate _delegate, TagomatConfig tgmConfig) : base(
        ApplicationState.Off,
        NLog.LogManager.GetLogger(nameof(ApplicationStateMachine)))
    {
        this._delegate = _delegate;
        _tagomatConfig = tgmConfig;

        SetupCommonTransitions();

        // We're running in standard (Tagomat) mode, and not in one-step mode
        if (!BagomatEnabled && !BagomatOneStepModeEnabled)
        {
            Builder
                .IfState(ApplicationState.Initializing)
                .GotInput(ApplicationInput.Initialized)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .Build();

            Builder
                .IfState(ApplicationState.TagomatWaitingForScan)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .Build();
        }

        if (!BagomatEnabled || BagomatOneStepModeEnabled)
        {
            Builder
                .IfState(ApplicationState.TagomatWaitingForScan)
                .GotInput(ApplicationInput.Stop)
                .TransitionTo(ApplicationState.Stopping)
                .OnTransition((sender, prevState, newState, input) => { _delegate.OnStopRequested(); })
                .Build();

            Builder
                .IfState(ApplicationState.TagomatWaitingForScan)
                .GotInput(ApplicationInput.Stopped)
                .TransitionTo(ApplicationState.Stopped)
                .Build();
        }

        if (BagomatEnabled || BagomatOneStepModeEnabled)
        {
            Logger.Info("Altering the standard state machine for Bagomat mode");

            // Bagomat is enabled

            if (BagomatOneStepModeEnabled)
            {
                Builder
                    .IfState(ApplicationState.Initializing)
                    .GotInput(ApplicationInput.Initialized)
                    .TransitionTo(ApplicationState.TagomatWaitingForScan)
                    .Build();
            }
            else
            {
                Builder
                    .IfState(ApplicationState.Initializing)
                    .GotInput(ApplicationInput.Initialized)
                    .TransitionTo(ApplicationState.WaitingForBag)
                    .Build();
            }

            Builder
                .IfState(ApplicationState.WaitingForBag)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            if (BagomatEnabled || BagomatOneStepModeEnabled)
            {
                Builder
                    .IfState(ApplicationState.WaitingForBag)
                    .GotInput(ApplicationInput.BagPlaced)
                    .TransitionTo(ApplicationState.BagomatWaitingForScan)
                    .Build();

                Builder
                    .IfState(ApplicationState.BagomatWaitingForScan)
                    .GotInput(ApplicationInput.Reset)
                    .TransitionTo(ApplicationState.WaitingForBag)
                    .Build();
            }
            else
            {
                Builder
                    .IfState(ApplicationState.WaitingForBag)
                    .GotInput(ApplicationInput.BagPlaced)
                    .TransitionTo(ApplicationState.TagomatWaitingForScan)
                    .Build();
            }

            Builder
                .IfState(ApplicationState.TagomatWaitingForScan)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.WaitingForBag)
                .Build();

            #region Stop

            Builder
                .IfState(ApplicationState.WaitingForBag)
                .GotInput(ApplicationInput.Stop)
                .TransitionTo(ApplicationState.Stopping)
                .OnTransition((sender, prevState, newState, input) => { _delegate.OnStopRequested(); })
                .Build();

            Builder
                .IfState(ApplicationState.WaitingForBag)
                .GotInput(ApplicationInput.Stopped)
                .TransitionTo(ApplicationState.Stopped)
                .Build();

            #endregion

            Builder
                .IfState(ApplicationState.CommunicatingWithDCS)
                .GotInput(ApplicationInput.SendingBag)
                .TransitionTo(ApplicationState.SendingBag)
                .Build();

            Builder
                .IfState(ApplicationState.SendingBag)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.SendingBag)
                .GotInput(ApplicationInput.ReverseBag)
                .TransitionTo(ApplicationState.ReversingBag)
                .Build();

            Builder
                .IfState(ApplicationState.ReversingBag)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.ReversingBag)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.WaitingForBag)
                .Build();

            Builder
                .IfState(ApplicationState.SendingBag)
                .GotInput(ApplicationInput.BagSent)
                .TransitionTo(ApplicationState.BagSent)
                .Build();

            if (BagomatOneStepModeEnabled)
            {
                Builder
                    .IfState(ApplicationState.BagSent)
                    .GotInput(ApplicationInput.Reset)
                    .TransitionTo(ApplicationState.TagomatWaitingForScan)
                    .Build();

                Builder
                    .IfState(ApplicationState.BagSent)
                    .GotInput(ApplicationInput.ResetBagomatOneStep)
                    .TransitionTo(ApplicationState.TagomatWaitingForScan)
                    .Build();
            }
            else
            {
                Builder
                    .IfState(ApplicationState.BagSent)
                    .GotInput(ApplicationInput.Reset)
                    .TransitionTo(ApplicationState.WaitingForBag)
                    .Build();
            }
        }

        Builder
            .IfState(ApplicationState.TagomatWaitingForScan)
            .GotInput(ApplicationInput.ProcessScan)
            .TransitionTo(ApplicationState.ProcessingScan)
            .Build();

        if (BagomatEnabled)
        {
            Builder
                .IfState(ApplicationState.BagomatWaitingForScan)
                .GotInput(ApplicationInput.ProcessScan)
                .TransitionTo(ApplicationState.ProcessingScan)
                .Build();
        }

        if (MeasuringEnabled)
        {
            // used by the test measuring button in the dev menu
            Builder
                .IfState(ApplicationState.TagomatWaitingForScan)
                .GotInput(ApplicationInput.StartMeasuring)
                .TransitionTo(ApplicationState.Measuring)
                .Build();

            Builder
                .IfState(ApplicationState.Measuring)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .Build();

            Builder
                .IfState(ApplicationState.MeasurementOverride)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .Build();
        }

        if (!BagomatEnabled || BagomatOneStepModeEnabled)
        {
            Builder
                .IfState(ApplicationState.SecurityQuestions)
                .GotInput(ApplicationInput.ProcessScan)
                .TransitionTo(ApplicationState.ProcessingScan)
                .Build();

            Builder
                .IfState(ApplicationState.SecurityQuestions)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.SecurityQuestions)
                .GotInput(ApplicationInput.CommunicateWithDCS)
                .TransitionTo(ApplicationState.CommunicatingWithDCS)
                .Build();

            Builder
                .IfState(ApplicationState.CommunicatingWithDCS)
                .GotInput(ApplicationInput.AskSecurityQuestions)
                .TransitionTo(ApplicationState.SecurityQuestions)
                .Build();
        }

        Builder
            .IfState(ApplicationState.ProcessingScan)
            .GotInput(ApplicationInput.CommunicateWithDCS)
            .TransitionTo(ApplicationState.CommunicatingWithDCS)
            .Build();

        if (BagomatEnabled)
        {
            Builder
                .IfState(ApplicationState.BagomatWaitingForScan)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();
        }

        if (!BagomatEnabled || BagomatOneStepModeEnabled)
        {
            Builder
                .IfState(ApplicationState.TagomatWaitingForScan)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();
        }

        if (!BagomatEnabled || BagomatOneStepModeEnabled)
        {
            // only a Tagomat can print
            Builder
                .IfState(ApplicationState.CommunicatingWithDCS)
                .GotInput(ApplicationInput.Print)
                .TransitionTo(ApplicationState.Printing)
                .Build();
        }

        Builder
            .IfState(ApplicationState.ProcessingScan)
            .GotInput(ApplicationInput.Fail)
            .TransitionTo(ApplicationState.Error)
            .OnTransition((sender, prevState, newState, input) => { _delegate.OnScanFailed(); })
            .Build();

        Builder
            .IfState(ApplicationState.CommunicatingWithDCS)
            .GotInput(ApplicationInput.Fail)
            .TransitionTo(ApplicationState.Error)
            .OnTransition((sender, prevState, newState, input) => { _delegate.OnCommunicationWithDCSFailed(); })
            .Build();

        if (!BagomatEnabled || BagomatOneStepModeEnabled)
        {
            Builder
                .IfState(ApplicationState.Printing)
                .GotInput(ApplicationInput.FinishedPrinting)
                .TransitionTo(ApplicationState.FinishedPrinting)
                .Build();

            Builder
                .IfState(ApplicationState.Printing)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .OnTransition((sender, prevState, newState, input) => { _delegate.OnPrintFailed(); })
                .Build();

            Builder
                .IfState(ApplicationState.FinishedPrinting)
                .GotInput(ApplicationInput.WaitForScan)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .Build();

            if (BagomatOneStepModeEnabled)
            {
                // transition to Bagomat
                Builder
                    .IfState(ApplicationState.FinishedPrinting)
                    .GotInput(ApplicationInput.Reset)
                    .TransitionTo(ApplicationState.WaitingForBag)
                    .OnTransition((sender, prevState, newState, input) => { _delegate.OnReset(); })
                    .Build();
            }
            else
            {
                Builder
                    .IfState(ApplicationState.FinishedPrinting)
                    .GotInput(ApplicationInput.Reset)
                    .TransitionTo(ApplicationState.TagomatWaitingForScan)
                    .OnTransition((sender, prevState, newState, input) => { _delegate.OnReset(); })
                    .Build();
            }

            Builder
                .IfState(ApplicationState.SecurityQuestions)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .OnTransition((sender, prevState, newState, input) => { _delegate.OnReset(); })
                .Build();


            Builder
                .IfState(ApplicationState.FinishedPrinting)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();
        }

        if (ScaleEnabled && !BagomatEnabled)
        {
            Builder
                .IfState(ApplicationState.PreWeighing)
                .GotInput(ApplicationInput.Stop)
                .TransitionTo(ApplicationState.Stopping)
                .OnTransition((sender, state, newState, input) => { _delegate.OnStopRequested(); })
                .Build();
        }

        Builder
            .IfState(ApplicationState.Stopping)
            .GotInput(ApplicationInput.Stopped)
            .TransitionTo(ApplicationState.Stopped)
            .Build();

        Builder
            .IfState(ApplicationState.Error)
            .GotInput(ApplicationInput.Initialize)
            .TransitionTo(ApplicationState.Initializing)
            .Build();

        Builder
            .IfState(ApplicationState.Error)
            .GotInput(ApplicationInput.Fail)
            .TransitionTo(ApplicationState.Error)
            .Build();

        if (!BagomatEnabled || BagomatOneStepModeEnabled)
        {
            Builder
                .IfState(ApplicationState.Error)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.TagomatWaitingForScan)
                .Build();

            Builder
                .IfState(ApplicationState.Error)
                .GotInput(ApplicationInput.ResetBagomatOneStep)
                .TransitionTo(ApplicationState.WaitingForBag)
                .Build();
        }
        else
        {
            Builder
                .IfState(ApplicationState.Error)
                .GotInput(ApplicationInput.Reset)
                .TransitionTo(ApplicationState.WaitingForBag)
                .Build();
        }

        Builder
            .IfState(ApplicationState.Error)
            .GotInput(ApplicationInput.Stopped)
            .TransitionTo(ApplicationState.Stopped)
            .Build();

        if (ScaleEnabled && !BagomatEnabled)
        {
            Builder
                .IfState(ApplicationState.CommunicatingWithDCS)
                .GotInput(ApplicationInput.PreWeight)
                .TransitionTo(ApplicationState.PreWeighing)
                .OnTransition((sender, state, newState, input) => { _delegate.OnRequestedPreWeight(); })
                .Build();

            Builder
                .IfState(ApplicationState.PreWeighing)
                .GotInput(ApplicationInput.StartedWeighing)
                .TransitionTo(ApplicationState.Weighing)
                .Build();

            Builder
                .IfState(ApplicationState.PreWeighing)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.Weighing)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.Weighing)
                .GotInput(ApplicationInput.Print)
                .TransitionTo(ApplicationState.Printing)
                .Build();
        }

        if (ScaleEnabled && MeasuringEnabled)
        {
            Builder
                .IfState(ApplicationState.Weighing)
                .GotInput(ApplicationInput.StartMeasuring)
                .TransitionTo(ApplicationState.Measuring)
                .Build();
        }

        if (MeasuringEnabled)
        {
            Builder
                .IfState(ApplicationState.Measuring)
                .GotInput(ApplicationInput.MeasurementOverride)
                .TransitionTo(ApplicationState.MeasurementOverride)
                .Build();

            Builder
                .IfState(ApplicationState.Measuring)
                .GotInput(ApplicationInput.Print)
                .TransitionTo(ApplicationState.Printing)
                .Build();

            Builder
                .IfState(ApplicationState.Measuring)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.MeasurementOverride)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.MeasurementOverride)
                .GotInput(ApplicationInput.Print)
                .TransitionTo(ApplicationState.Printing)
                .Build();
        }

        if (PassportReaderEnabled)
        {
            Builder
                .IfState(ApplicationState.CommunicatingWithDCS)
                .GotInput(ApplicationInput.ValidatePassport)
                .TransitionTo(ApplicationState.ValidatingPassport)
                .Build();
        }

        if (PassportReaderEnabled && MeasuringEnabled)
        {
            Builder
                .IfState(ApplicationState.Measuring)
                .GotInput(ApplicationInput.ValidatePassport)
                .TransitionTo(ApplicationState.ValidatingPassport)
                .Build();

            Builder
                .IfState(ApplicationState.MeasurementOverride)
                .GotInput(ApplicationInput.ValidatePassport)
                .TransitionTo(ApplicationState.ValidatingPassport)
                .Build();
        }

        if (ScaleEnabled && PassportReaderEnabled)
        {
            Builder
                .IfState(ApplicationState.Weighing)
                .GotInput(ApplicationInput.ValidatePassport)
                .TransitionTo(ApplicationState.ValidatingPassport)
                .Build();
        }

        if (PassportReaderEnabled)
        {
            Builder
                .IfState(ApplicationState.ValidatingPassport)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.ValidatingPassport)
                .GotInput(ApplicationInput.CommunicateWithDCS)
                .TransitionTo(ApplicationState.CommunicatingWithDCS)
                .Build();
        }

        if (MeasuringEnabled && PaymentEnabled)
        {
            Builder
                .IfState(ApplicationState.Measuring)
                .GotInput(ApplicationInput.CheckPaymentNeeded)
                .TransitionTo(ApplicationState.CheckingPaymentNeeded)
                .Build();
        }

        if (MeasuringEnabled && PaymentEnabled)
        {
            Builder
                .IfState(ApplicationState.MeasurementOverride)
                .GotInput(ApplicationInput.CheckPaymentNeeded)
                .TransitionTo(ApplicationState.CheckingPaymentNeeded)
                .Build();
        }

        if (PaymentEnabled)
        {
            Builder
                .IfState(ApplicationState.CommunicatingWithDCS)
                .GotInput(ApplicationInput.CheckPaymentNeeded)
                .TransitionTo(ApplicationState.CheckingPaymentNeeded)
                .Build();

            Builder
                .IfState(ApplicationState.CheckingPaymentNeeded)
                .GotInput(ApplicationInput.HandlePayment)
                .TransitionTo(ApplicationState.HandlingPayment)
                .Build();

            Builder
                .IfState(ApplicationState.CheckingPaymentNeeded)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.CheckingPaymentNeeded)
                .GotInput(ApplicationInput.CommunicateWithDCS)
                .TransitionTo(ApplicationState.CommunicatingWithDCS)
                .Build();

            Builder
                .IfState(ApplicationState.HandlingPayment)
                .GotInput(ApplicationInput.PaymentSucceeded)
                .TransitionTo(ApplicationState.PaymentSucceeded)
                .Build();

            Builder
                .IfState(ApplicationState.HandlingPayment)
                .GotInput(ApplicationInput.Fail)
                .TransitionTo(ApplicationState.Error)
                .Build();

            Builder
                .IfState(ApplicationState.PaymentSucceeded)
                .GotInput(ApplicationInput.CommunicateWithDCS)
                .TransitionTo(ApplicationState.CommunicatingWithDCS)
                .Build();
        }
    }

    private void SetupCommonTransitions()
    {
        Builder
            .IfState(ApplicationState.Off)
            .GotInput(ApplicationInput.Initialize)
            .TransitionTo(ApplicationState.Initializing)
            .OnTransition((sender, prevState, newState, input) => { _delegate.OnInitRequested(); })
            .Build();

        Builder
            .IfState(ApplicationState.Initializing)
            .GotInput(ApplicationInput.Fail)
            .TransitionTo(ApplicationState.Error)
            .OnTransition((sender, prevState, newState, input) => { _delegate.OnInitFailed(); })
            .Build();
    }

    public string GetGraph()
    {
        var graphCompiler = new StateMachineGraphCompiler<ApplicationState, ApplicationInput>(this);
        var dotGraph = graphCompiler.CompileDotGraph();

        return dotGraph;
    }
}