public static void WriteSample(string targetDirectory, IFileSystem fileSystem)
        {
            if (fileSystem == null)
            {
                throw new ArgumentNullException(nameof(fileSystem));
            }

            var configFilePath = GetConfigFilePath(targetDirectory);

            if (!fileSystem.Exists(configFilePath))
            {
                _logger.Information("Writing sample file to '{ConfigFilePath}'", configFilePath);

                // The following try/finally statements is to ensure that
                // any stream is not disposed more than once.
                Stream stream = null;
                try
                {
                    stream = fileSystem.OpenWrite(configFilePath);
                    using (var writer = new StreamWriter(stream))
                    {
                        stream = null;
                        ConfigSerializer.WriteSample(writer);
                    }
                }
                finally
                {
                    stream?.Dispose();
                }
            }
            else
            {
                _logger.Error("Cannot write sample, '{File}' already exists", configFilePath);
            }
        }
        public static void WriteSample(string targetDirectory, IFileSystem fileSystem)
        {
            if (fileSystem == null)
            {
                throw new ArgumentNullException(nameof(fileSystem));
            }

            var configFilePath = GetConfigFilePath(targetDirectory);

            if (!fileSystem.Exists(configFilePath))
            {
                using (var stream = fileSystem.OpenWrite(configFilePath))
                    using (var writer = new StreamWriter(stream))
                    {
                        ConfigSerializer.WriteSample(writer);
                    }
            }
            else
            {
                Logger.WriteError("Cannot write sample, GitReleaseManager.yaml already exists");
            }
        }