protected function buildControlHandlerLoop() {
        $controlHandlerCases = $this->buildControlHandlerCases();
        $result = '';
        if (!empty($controlHandlerCases)) {
            $result = '        foreach (Event in PendingEvents) {' . PHP_EOL
                    . '            switch (Event.Type) {' . PHP_EOL
                    . $controlHandlerCases
                    . '            }' . PHP_EOL
                    . '        }' . PHP_EOL;
        }
        return $result;
    }