Serializer

Add a serializer to take care of all to_capsule_json stuff. Later hopefully this could be moved out of all models and used directly by the connection. Resolves #51