Resharper cleanup code.
Refacotring: removed the switch with the dictionary and delegates.