Move all conversions to a separate module

Adds `to_binary` conversions for prepared statements.