/// <summary>
        /// Generates the diagram.
        /// </summary>
        /// <param name="repository">The repository.</param>
        /// <param name="package">The package.</param>
        public static void GenerateDiagram(Repository repository, Package package)
        {
            chkPackage        = package;
            pRepository       = repository;
            ProgressInfo.Info = Resources.stateGenDiagram;
            DiagramObjects dobjs = new DiagramObjects();

            Package newPackage = Manipulation.AddPackage(chkPackage, "Package Dependencies");

            object objDiagram = newPackage.Diagrams.AddNew(chkPackage.Name + " - " + appSettings.Stereotype, appSettings.Type);

            if (!Equals(objDiagram, null))
            {
                Diagram pdDiagram = (Diagram)objDiagram;
                pdDiagram.Stereotype = "generated";

                if (pdDiagram.Update())
                {
                    ProgressInfo.Info = Resources.stateSearchCurDep;

                    DependingPackageList currentDependency = CurrentDependencies(chkPackage);
                    IEnumerator          enumCurrent       = currentDependency.GetEnumerator();
                    enumCurrent.Reset();

                    ProgressInfo.Reset(Resources.stateCreateDiagram, 0, currentDependency.Count);
                    while (enumCurrent.MoveNext())
                    {
                        ProgressInfo.Next();
                        DependingPackages dp = (DependingPackages)enumCurrent.Current;

                        if (dp != null && !dobjs.IsInList(dp.Element1.ElementID))
                        {
                            object objDObj = pdDiagram.DiagramObjects.AddNew("", "");
                            if (!Equals(objDObj, null))
                            {
                                dobjs.Add(AddElementToDiagram(pdDiagram, dp.Element1));
                            }
                        }

                        if (dp != null && !dobjs.IsInList(dp.Element2.ElementID))
                        {
                            object objDObj = pdDiagram.DiagramObjects.AddNew("", "");
                            if (!Equals(objDObj, null))
                            {
                                dobjs.Add(AddElementToDiagram(pdDiagram, dp.Element2));
                            }
                        }
                    }

                    pRepository.OpenDiagram(pdDiagram.DiagramID);
                    pRepository.App.Project.LayoutDiagram(pdDiagram.DiagramGUID, 0);
                    pRepository.SaveDiagram(pdDiagram.DiagramID);

                    ProgressInfo.Info = Resources.stateFinished;
                }
            }
        }