From http://www.codeproject.com/Articles/248440/Universal-Type-Converter