public ISpotifyClient GetSpotifyClient()
    {
        var clientInfo = new SpotifyClientInfo(
            EnvHelpers.GetEnvOrDefault("SPOTPG_SPOTIFY_CLIENT_ID", this.configuration.ClientId),
            EnvHelpers.GetEnvOrDefault("SPOTPG_SPOTIFY_CLIENT_SECRET", this.configuration.ClientSecret));

        if (this.client != null && this.currentInfo == clientInfo)
        {
            return(this.client);
        }

        this.serviceLogger.LogInfo("Recreation Spotify client...");

        var authResponse = new AuthorizationCodeTokenResponse
        {
            AccessToken  = this.configuration.AccessToken,
            RefreshToken = this.configuration.RefreshToken
        };

        var auth = new AuthorizationCodeAuthenticator(clientInfo.Id, clientInfo.Secret, authResponse);

        var config = SpotifyClientConfig.CreateDefault()
                     .WithDefaultPaginator(new SimplePaginator())
                     .WithRetryHandler(new SimpleRetryHandler())
                     .WithAuthenticator(auth);

        this.client      = new SpotifyClient(config);
        this.currentInfo = clientInfo;

        this.serviceLogger.LogInfo("New Spotify client was created successfully");

        return(this.client);
    }
        private void ConfigMaxUploadSize(IServiceCollection services)
        {
            if (EnvHelpers.IsRunningInProcessIIS())
            {
                services.Configure <IISServerOptions>(options =>
                {
                    options.MaxRequestBodySize = AppContractConsts.MaxFileSizeInBytes;
                });
            }
            else
            {
                services.Configure <KestrelServerOptions>(options =>
                {
                    options.Limits.MaxRequestBodySize = AppContractConsts.MaxFileSizeInBytes;
                });
            }

            services.Configure <FormOptions>(options =>
            {
                options.ValueLengthLimit            = int.MaxValue;
                options.MultipartBodyLengthLimit    = int.MaxValue; // if don't set default value is: 128 MB
                options.MultipartHeadersLengthLimit = int.MaxValue;
            });
        }