protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();


            var binder = new BootstrapVillas.CustomModelBinders.DateTimeUKModelBinder();
            ModelBinders.Binders.Add(typeof(DateTime), binder);
            ModelBinders.Binders.Add(typeof(DateTime?), binder);


            Database.SetInitializer<PortugalVillasContext>(null);
            Database.SetInitializer<UsersContext>(null);

            //membership provider
            if (!WebSecurity.Initialized)
            {
                WebSecurity.InitializeDatabaseConnection("PortugalVillasContext", "UserProfile", "UserId", "UserName",
                    true);
            }

            //update currency
            try
            {
                var autoMate = new PRCAutomations();
                var ok = autoMate.UpdateCurrencyExchangeRates();

            }
            catch (Exception ex)
            {

                //ignore
            }

            //get a token for the translator every 500 seconds and store it in the viewbag
            Timer translateTimer = new Timer(600000);
            translateTimer.Elapsed += translateTimer_Elapsed;
            Application["TranslateToken"] = GetBingAPITranslationToken();
            translateTimer.Enabled = true;
            GC.KeepAlive(translateTimer);


            //update currency every hr  
            Timer currencyUpdateTimer = new Timer(3600000);
            currencyUpdateTimer.Elapsed += currencyUpdateTimer_Elapsed;
            currencyUpdateTimer.Enabled = true;
            GC.KeepAlive(currencyUpdateTimer);


            InitCache();


            var defaultCurrencyEnum = (CurrencyEnum)Enum.Parse(typeof(CurrencyEnum), ConfigurationManager.AppSettings["defaultCurrency"]);
            var currencies = new List<CurrencyExchange>();

            using (var db = new PortVillasContext())
            {
                currencies = db.CurrencyExchanges.ToList();
            }


            //structuremap
            IContainer container = new Container(cfg =>
            {
                cfg.Scan(x => x.WithDefaultConventions());

                cfg.For<ICurrencyConvert>()
                    .Singleton()
                    .Use(() => CurrencyConverterFactory.GetCurrencyConverter(defaultCurrencyEnum, currencies));

            }
            
            );
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));


        }
        void currencyUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            var autoMate =
              new PRCAutomations();
            var ok = autoMate.UpdateCurrencyExchangeRates();

            if (ok.Equals(0))
            {

            }
            else
            { }

        }