Added support for converting object to dictionary.