private static void SetupViewModel(object viewModel, FrameworkElement view, IBusyIndicatorHandler busyIndicatorHandler)
    {
        if (viewModel is not IBusyIndicatorViewModel busyIndicatorViewModel)
        {
            return;
        }

        var type         = busyIndicatorViewModel.GetType();
        var propertyName = nameof(IBusyIndicatorViewModel.BusyIndicatorHandler);

        // Check if the 'BusyIndicatorHandler' property has an accessible setter.
        var propertyInfo = type.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance);

        if (propertyInfo?.CanWrite ?? false)
        {
            propertyInfo.SetValue(viewModel, busyIndicatorHandler);
            return;
        }

        // Since the 'BusyIndicatorHandler' property has no setter, its backing field must be manipulated through reflection.
        var fieldInfo = type.GetField($"<{propertyName}>k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic);

        if (fieldInfo != null)
        {
            fieldInfo.SetValue(viewModel, busyIndicatorHandler);
            return;
        }

        Trace.WriteLine($"ERROR: Could not inject a '{nameof(IBusyIndicatorHandler)}' into the view model '{type.Name}' as its '{propertyName}' property either has no setter or its backing field could not be found.");
    }
 /// <summary>
 /// Callback that initializes the <see cref="IBusyIndicatorViewModel.BusyIndicatorHandler"/> property of an <see cref="IBusyIndicatorHandler"/>.
 /// </summary>
 /// <param name="viewModel"> The view model. </param>
 /// <param name="view"> The view as <see cref="FrameworkElement"/>. </param>
 /// <param name="busyIndicatorHandler"> An <see cref="IBusyIndicatorHandler"/> instance. This instance should be a different one per viewmodel. </param>
 public static void Callback(object viewModel, FrameworkElement view, IBusyIndicatorHandler busyIndicatorHandler)
 {
     SetupViewModel(viewModel, view, busyIndicatorHandler);
 }