/// <summary>
 /// Resolves the current <see cref="_executionMode"/>.
 /// Handles <see cref="HttpRecorderMode.Auto"/>, if this is the case, otherwise uses the current <see cref="Mode"/>.
 /// </summary>
 /// <param name="cancellationToken">A cancellation token to cancel operation.</param>
 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
 private async Task ResolveExecutionMode(CancellationToken cancellationToken)
 {
     if (!_executionMode.HasValue)
     {
         if (Mode == HttpRecorderMode.Auto)
         {
             _executionMode = (await _repository.ExistsAsync(InteractionName, cancellationToken))
                 ? HttpRecorderMode.Replay
                 : HttpRecorderMode.Record;
         }
         else
         {
             _executionMode = Mode;
         }
     }
 }
        /// <summary>
        /// Resolves the current <see cref="_executionMode"/>.
        /// Handles <see cref="OverridingEnvironmentVariableName"/> and <see cref="HttpRecorderMode.Auto"/>, if they are set (in that priority order),
        /// otherwise uses the current <see cref="Mode"/>.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token to cancel operation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        private async Task ResolveExecutionMode(CancellationToken cancellationToken)
        {
            if (!_executionMode.HasValue)
            {
                var overridingEnvVarValue = Environment.GetEnvironmentVariable(OverridingEnvironmentVariableName);
                if (!string.IsNullOrWhiteSpace(overridingEnvVarValue) && Enum.TryParse <HttpRecorderMode>(overridingEnvVarValue, out var parsedOverridingEnvVarValue))
                {
                    _executionMode = parsedOverridingEnvVarValue;
                    return;
                }

                if (Mode == HttpRecorderMode.Auto)
                {
                    _executionMode = (await _repository.ExistsAsync(InteractionName, cancellationToken))
                        ? HttpRecorderMode.Replay
                        : HttpRecorderMode.Record;

                    return;
                }

                _executionMode = Mode;
            }
        }