/// <summary>
        ///     Builds the container.
        /// </summary>
        /// <returns>An instance of <see cref="IUnityContainer"/>.</returns>
        internal static IUnityContainer BuildContainer()
        {
            var container = new UnityContainer();

            container.RegisterType <ISettings, Settings>();
            container.ConfigureServices(() => new ContainerControlledLifetimeManager());

            // handlers
            container.RegisterType <IHandler <BalanceChangedMessage>, CustomerAccountHandler>();

            return(container);
        }
        /// <summary>
        ///     Builds the unity container.
        /// </summary>
        /// <returns></returns>
        private static IUnityContainer BuildUnityContainer()
        {
            // configure services
            var container = new UnityContainer();

            container.ConfigureServices(_perRequestManagerFactory);

            // override service registrations

            container.RegisterType <IAccountService, AccountServiceDecorator>(
                container.Decorate <IAccountService>(s => new AccountServiceDecorator(s, container.Resolve <IHubConnectionContext <dynamic> >())));

            container.RegisterType <IJournalService, JournalServiceDecorator>(
                container.Decorate <IJournalService>(s => new JournalServiceDecorator(s, container.Resolve <IHubConnectionContext <dynamic> >())));

            // configure app
            container.RegisterInstance(GlobalHost.ConnectionManager);
            container.RegisterHubContext <NotificationHub>();

            return(container);
        }