private void TryParseConfiguration()
        {
            if (!File.Exists(_configPath))
            {
                return;
            }

            using (var stream = File.OpenText(_configPath))
            {
                var reader = new JsonTextReader(stream);
                _jsonObject = JObject.Load(reader);

                JToken token;
                if (_jsonObject.TryGetValue(_packagesTag, out token))
                {
                    var builder = new PackageGraphBuilder();
                    foreach (var package in token.Children())
                    {
                        var packageProp   = (JProperty)package;
                        var packageObject = (JObject)packageProp.Value;

                        var packageId = new PackageId(packageProp.Name);
                        var info      = new ProductPackageInfo();

                        if (packageObject.TryGetValue(_packageTag, out token))
                        {
                            var packageConfigObject = (JObject)token;
                            info.Configuration = new PackageConfiguration(packageId, packageConfigObject);

                            if (packageObject.TryGetValue(_filesTag, out token) && token.HasValues)
                            {
                                var array = (JArray)token;
                                info.Files.AddRange(array.Select(x => new PackageFileInfo(x.ToString())));
                            }

                            var dependencies = new List <PackageId>();
                            if (packageObject.TryGetValue(_dependenciesTag, out token) && token.HasValues)
                            {
                                var array = (JArray)token;
                                dependencies.AddRange(array.Select(x => new PackageId(x.ToString())));
                            }

                            builder.Append(packageId, dependencies);
                            ProductPackages.Add(info);
                        }
                    }

                    Packages            = builder.Build();
                    IsProductConfigured = true;
                }
            }
        }
        /// <summary>
        /// Reconfigures product configuration by replacing it with the provided configuration
        /// </summary>
        /// <param name="packages">New list of the packages</param>
        /// <param name="packageGraph">Package dependencies</param>
        /// <param name="files">Package files</param>
        public void Reconfigure(IEnumerable <IPackageConfiguration> packages, IPackageGraph packageGraph,
                                IDictionary <PackageId, IEnumerable <IPackageFile> > files)
        {
            Packages = packageGraph;

            ProductPackages.Clear();
            foreach (var package in packages)
            {
                var info = new ProductPackageInfo
                {
                    Configuration = package
                };

                var packageFiles = files.FirstOrDefault(f => f.Key.IsSamePackage(package.Id)).Value;
                if (packageFiles != null)
                {
                    info.Files.AddRange(packageFiles);
                }

                ProductPackages.Add(info);
            }
        }