/// <summary>
        /// Update All TriTech Default Templates in the System
        /// </summary>
        public static void UpdateAllAgencies()
        {
            // Get the list of Agencies in the System.
            List <Guid> agencyIds;

            using (var admin = new AdministrationDbContext())
                agencyIds = admin.GetEntityQuery <Domain.Administration.Aggregates.Agency.Agency>()
                            .Select(x => x.Id)
                            .ToList();

            // We can use the same Metadata Context because we are only reading data.
            using (var meta = new MetadataDbContext())
            {
                foreach (var agencyId in agencyIds)
                {
                    // Distribute the work so we do not pay the performance price
                    // of tracking too many entities at the same time.
                    // This is important in systems that have a lot of Agencies.
                    using (var admin = new AdministrationDbContext())
                    {
                        // Load the Agency
                        var agency = admin.GetAgency(agencyId);

                        // Update the Templates
                        UpdateTriTechDefaultTemplatesInAgency(agency, admin, meta);

                        // Commit the Work
                        admin.Commit();
                    }
                }
            }
        }
        /// <summary>
        /// Update The Implementation Default Templates for all Agencies in the System.
        /// </summary>
        /// <param name="implementation">The State Implementation of the System.</param>
        public static void UpdateAllAgencies(string implementation)
        {
            using (var meta = new MetadataDbContext())
                using (var admin = new AdministrationDbContext())
                {
                    // Install or Update Templates in All Agencies
                    admin.GetEntityQuery <Domain.Administration.Aggregates.Agency.Agency>()
                    .ToList()
                    .ForEach(agency => InstallOrUpdateTemplatesInAgency(agency, implementation, admin, meta));

                    // Commit the Work
                    admin.Commit();
                }
        }