dynamic cast for input in controller