/// <summary>Returns the adapter instance that will be used.</summary>
        /// <param name="fileSystemScheme">The name of the fileSystm scheme being handled.</param>
        /// <returns>The adapter instance.</returns>
        public async Task <IFileSystemAdapter> GetAdapterAsync(string fileSystemScheme)
        {
            if (fileSystemScheme == null)
            {
                throw new ArgumentNullException(nameof(fileSystemScheme));
            }

            if (_adapterMap.TryGetValue(fileSystemScheme, out var adapter))
            {
                return(adapter);
            }

            var scheme = await Schemes.GetSchemeAsync(fileSystemScheme);

            if (scheme == null)
            {
                return(null);
            }

            adapter = (
                ServiceProvider.GetService(scheme.AdapterType)
                ?? ActivatorUtilities.CreateInstance(ServiceProvider, scheme.AdapterType, Array.Empty <object>()))
                      as IFileSystemAdapter;

            if (adapter != null)
            {
                await adapter.InitializeAsync(scheme);

                _adapterMap[fileSystemScheme] = adapter;
            }

            return(adapter);
        }