public void Write(List<PackageViewModel> packages, string file)
        {
            if (string.IsNullOrWhiteSpace(file))
            {
                file = "packages.dot";
            }
            
            var colors = new GraphVizColorConfiguration();
            var sb = new StringBuilder();
            
            WriteHeader(sb);
            foreach (var package in packages)
            {                                
                sb.AppendFormat(" \"{0}\"[fillcolor=\"{1}\",label=\"{2}\"];", 
                    package.GraphId(),
                    GraphHelper.GenerateBackgroundColor(packages, package, colors),
                    package.DisplayVersion()).AppendLine();

                var dependenciesToWrite = package.Dependencies.Select(dep =>
                    String.Format(" \"{0}\" -> \"{1}\";", package.GraphId(), DependencyNodeId(dep, packages))).ToArray();
                sb.AppendLine(String.Join(Environment.NewLine, dependenciesToWrite));                
            }
            WriteClose(sb);

            File.WriteAllText(file, sb.ToString());
        }
        public void Write(List <PackageViewModel> packages, string file)
        {
            if (string.IsNullOrWhiteSpace(file))
            {
                file = "packages.dot";
            }

            Debug.WriteLine($"Writing {file}.");

            var colors = new GraphVizColorConfiguration();
            var sb     = new StringBuilder();

            WriteHeader(sb);
            foreach (var package in packages)
            {
                sb.AppendFormat(" \"{0}\"[fillcolor=\"{1}\",label=\"{2}\"];",
                                package.GraphId(),
                                GraphHelper.GenerateBackgroundColor(packages, package, colors),
                                package.DisplayVersion()).AppendLine();

                var dependenciesToWrite = package.Dependencies.Select(dep =>
                                                                      String.Format(" \"{0}\" -> \"{1}\";", package.GraphId(), DependencyNodeId(dep, packages))).ToArray();
                sb.AppendLine(String.Join(Environment.NewLine, dependenciesToWrite));
            }
            WriteClose(sb);

            File.WriteAllText(file, sb.ToString());
        }