public async Task Acquire(string version)
        {
            var channelVersion = ParseChannelVersion(version);
            var platform       = _platformIdentifier.GetPlatform();

            using var releasesResponse = await JsonDocument.ParseAsync(await _httpClient.GetStreamAsync(ReleaseIndex));

            var channel = releasesResponse.RootElement.GetProperty("releases-index").EnumerateArray()
                          .First(x => x.GetProperty("channel-version").GetString() == channelVersion);

            var channelJson = channel.GetProperty("releases.json").GetString();

            using var channelResponse = await JsonDocument.ParseAsync(await _httpClient.GetStreamAsync(channelJson));

            var file = channelResponse
                       .RootElement.GetProperty("releases").EnumerateArray()
                       .SelectMany(x =>
            {
                IEnumerable <JsonElement> GetSdks()
                {
                    yield return(x.GetProperty("sdk"));

                    if (x.TryGetProperty("sdks", out var sdks))
                    {
                        foreach (var y in sdks.EnumerateArray())
                        {
                            yield return(y);
                        }
                    }
                }

                return(GetSdks());
            })
                       .First(x => x.GetProperty("version").GetString() == version)
                       .GetProperty("files")
                       .EnumerateArray()
                       .First(x => x.GetProperty("rid").GetString() == platform);

            var name         = file.GetProperty("name").GetString();
            var installerUrl = file.GetProperty("url").GetString();
            var fileHash     = file.GetProperty("hash").GetString();

            var filePath = Path.Combine(Path.GetTempPath(), name);

            using var installerStream = await _httpClient.GetStreamAsync(installerUrl);

            using var fileStream = new FileStream(filePath, FileMode.Create);
            var progress = new Progress <long>();

            var lastReportedBytesMbs = 0;

            progress.ProgressChanged += (sender, totalBytes) =>
            {
                var currentBytesMbs = (int)Math.Floor(totalBytes / Math.Pow(2, 20));
                if (currentBytesMbs <= lastReportedBytesMbs)
                {
                    return;
                }
                lastReportedBytesMbs = currentBytesMbs;
                _textWriter.SetCursorPosition(0, Console.CursorTop);
                _textWriter.Write($"Downloading: {currentBytesMbs}MB");
            };
            await CopyToWithProgress(installerStream, fileStream, progress);

            CheckHash(filePath, fileHash);

            _installerLauncher.Launch(filePath);
        }
        public async Task Acquire(Acquirable acquirable)
        {
            var result = await acquirable.Fetch(_httpClient);

            if (!result.IsSuccess)
            {
                return;
            }

            if (await CheckSdkExists(result.Version))
            {
                _textWriter.WriteLine($"SDK version {result.Version} is already installed.");
                return;
            }

            using var channelResponse = await JsonDocument.ParseAsync(await _httpClient.GetStreamAsync(result.ChannelJson));

            var file = channelResponse
                       .RootElement.GetProperty("releases").EnumerateArray()
                       .SelectMany(x =>
            {
                IEnumerable <JsonElement> GetSdks()
                {
                    yield return(x.GetProperty("sdk"));

                    if (x.TryGetProperty("sdks", out var sdks))
                    {
                        foreach (var y in sdks.EnumerateArray())
                        {
                            yield return(y);
                        }
                    }
                }

                return(GetSdks());
            })
                       .First(x => x.GetProperty("version").GetString() == result.Version)
                       .GetProperty("files")
                       .EnumerateArray()
                       .First(FileFilter);

            var name         = file.GetProperty("name").GetString();
            var installerUrl = file.GetProperty("url").GetString();
            var fileHash     = file.GetProperty("hash").GetString();

            var filePath = Path.Combine(Path.GetTempPath(), name);

            _textWriter.WriteLine($"Starting download of .NET Core SDK Version {result.Version}");
            using (var installerStream = await _httpClient.GetStreamAsync(installerUrl))
            {
                using var fileStream = new FileStream(filePath, FileMode.Create);
                var progress = new Progress <long>();

                var lastReportedBytesMbs = 0;
                progress.ProgressChanged += (sender, totalBytes) =>
                {
                    var currentBytesMbs = (int)Math.Floor(totalBytes / Math.Pow(2, 20));
                    if (currentBytesMbs <= lastReportedBytesMbs)
                    {
                        return;
                    }
                    lastReportedBytesMbs = currentBytesMbs;
                    _textWriter.SetCursorPosition(0, Console.CursorTop);
                    _textWriter.Write($"Downloading: {currentBytesMbs}MB");
                };

                await CopyToWithProgress(installerStream, fileStream, progress);
            }

            CheckHash(filePath, fileHash);
            _installerLauncher.Launch(filePath);
        }