please extract this switch-case block into its own method in order to increase readability