private static void BuildDiagram(Visio.Page page, List<Category> categories, List<Formula> formulae, List<Rule> rules, List<List> lists, List<Lookup> lookups)
        {
            Console.WriteLine("Drawing {0} categories...", categories.Count);
            DrawCategories(page, categories);

            Console.WriteLine("Drawing {0} rules...", rules.Count);
            DrawRules(page, rules);

            var listsToDraw = lists.Where(l => usedListNames.Contains(l.ListName.ToUpperInvariant()));
            Console.WriteLine("Drawing {0} lists...", listsToDraw.Count());
            DrawLists(page, listsToDraw);

            var lookupsToDraw = lookups.Where(l => usedLookupNames.Contains(l.TableName.ToUpperInvariant()));
            Console.WriteLine("Drawing {0} lookup tables...", lookupsToDraw.Count());
            DrawLookups(page, lookupsToDraw);

            var formulaeToDraw = formulae.Where(f => usedFormulaNames.Contains(f.FormulaName.ToUpperInvariant()));
            Console.WriteLine("Drawing {0} formulas...", formulaeToDraw.Count());
            DrawFormulae(page, formulaeToDraw);

            Console.WriteLine("Drawing {0} relations...", relations.Count);
            DrawRelations(page);

            Console.WriteLine();
            Console.WriteLine("Laying out the page...");
            page.Layout();

            Console.WriteLine("Resizing to fit to contents...");
            page.ResizeToFitContents();
        }