/// <summary>
        /// Executes the specified action with the given retry settings.
        /// </summary>
        /// <param name="retrySettings">The retry settings.</param>
        /// <param name="action">The action to automatically retry.</param>
        /// <returns>A Task which will have the resulting value when done.</returns>
        /// <exception cref="ProviderInaccessibleException">When unsuccessful. Examine InnerExceptions
        /// for details.</exception>
        public static TReturnType Execute <TReturnType>(
            RetrySettings retrySettings,
            Func <TReturnType> action)
        {
            var handler = new RetryHandler <TReturnType>(
                retrySettings,
                () => Task.FromResult(action()));

            return(handler.ExecuteAsync().GetAwaiter().GetResult());
        }
        /// <summary>
        /// Executes the specified action with the given retry settings.
        /// </summary>
        /// <param name="retrySettings">The retry settings.</param>
        /// <param name="action">The action to automatically retry.</param>
        /// <returns>Task.</returns>
        /// <exception cref="ProviderInaccessibleException">When unsuccessful. Examine InnerExceptions
        /// for details.</exception>
        public static void Execute(
            RetrySettings retrySettings,
            Action action)
        {
            var handler = new RetryHandler <bool>(
                retrySettings,
                () => { action(); return(Task.FromResult(false)); });

            handler.ExecuteAsync().GetAwaiter();
        }