/// <summary>
        /// Add an in-memory well partitioned token cache to MSAL.NET confidential client
        /// application. Don't use this method in ASP.NET Core: rather use:
        /// <code>services.AddInMemoryTokenCache()</code> in ConfigureServices.
        /// </summary>
        /// <param name="confidentialClientApp">Confidential client application.</param>
        /// <returns>The application for chaining.</returns>
        /// <example>
        ///
        /// The following code adds an in-memory token cache.
        ///
        /// <code>
        ///  app.AddInMemoryTokenCache();
        /// </code>
        ///
        /// </example>
        /// <remarks>Don't use this method in ASP.NET Core. Just add use the ConfigureServices method
        /// instead.</remarks>
        public static IConfidentialClientApplication AddInMemoryTokenCache(
            this IConfidentialClientApplication confidentialClientApp)
        {
            _ = confidentialClientApp ?? throw new ArgumentNullException(nameof(confidentialClientApp));

            confidentialClientApp.AddTokenCaches(services =>
            {
                services.AddInMemoryTokenCaches();
            });
            return(confidentialClientApp);
        }
        /// <summary>
        /// Add an in-memory well partitioned token cache to MSAL.NET confidential client
        /// application. Don't use this method in ASP.NET Core: rather use:
        /// <code>services.AddInMemoryTokenCache()</code> in ConfigureServices.
        /// </summary>
        /// <param name="confidentialClientApp">Confidential client application.</param>
        /// <param name="initializeMemoryCache">Action taking a <see cref="IServiceCollection"/>
        /// and by which you initialize your memory cache.</param>
        /// <returns>The application for chaining.</returns>
        /// <example>
        ///
        /// The following code adds an in-memory token cache.
        ///
        /// <code>
        ///  app.AddInMemoryTokenCache(services =>
        ///  {
        ///       services.Configure&lt;MemoryCacheOptions&gt;(options =>
        ///       {
        ///           options.SizeLimit = 5000000; // in bytes (5 Mb), for example
        ///       });
        ///  });
        /// </code>
        ///
        /// </example>
        /// <remarks>Don't use this method in ASP.NET Core. Just add use the ConfigureServices method
        /// instead.</remarks>
        public static IConfidentialClientApplication AddInMemoryTokenCache(
            this IConfidentialClientApplication confidentialClientApp,
            Action <IServiceCollection> initializeMemoryCache)
        {
            _ = confidentialClientApp ?? throw new ArgumentNullException(nameof(confidentialClientApp));
            _ = initializeMemoryCache ?? throw new ArgumentNullException(nameof(initializeMemoryCache));

            confidentialClientApp.AddTokenCaches(services =>
            {
                services.AddInMemoryTokenCaches();
                initializeMemoryCache(services);
            });
            return(confidentialClientApp);
        }