private function configureDI()
    {
        /** @var \DI\Container $container */
        $container = $this->getContainer();

        $this->add(new NotificationMiddleware($container));
        $this->add(new OldInputDataMiddleware($container));

        // Random Number Generator
        $container->set(Generator::class, function () {
            $randomNumberGeneratorFactory = new RandomNumberGeneratorFactory;
            $randomNumberGenerator = $randomNumberGeneratorFactory
                ->getGenerator(new RandomNumberStrength(RandomNumberStrength::MEDIUM));

            return $randomNumberGenerator;
        });

        $container->set(TokenGenerator::class, \DI\object()->constructor(\DI\get(Generator::class)));

        $container->set('logger', function ($c) {
            $logger = new Logger('eventerza');
            $logSettings = $c->get('settings.log');
            $logLevel = $logSettings['level'];
            $isSlackEnabled = $logSettings['enableSlack'];
            $fileHandler = new StreamHandler("../var/logs/app.log", $logLevel);
            $logger->pushHandler($fileHandler);

            if ($isSlackEnabled) {
                $slackHandler = new SlackWebhookHandler(
                    $logSettings['slackWebhookUrl'],
                    'prod-alerts',
                    'CriticalLog',
                    true,
                    null,
                    false,
                    true,
                    Logger::CRITICAL,
                    true,
                    array()
                );
                $logger->pushHandler($slackHandler);
            }

            return $logger;
        });
    }