Trainer: Adding methods to serialize and deserialize trainers

The serialized form is a JSON compatible dictionary.