Add basic serialization support.

Test Plan: make test

Reviewers: radu.hambasan, m.iancu

Reviewed By: radu.hambasan

Differential Revision: http://phab.code4fun.de/D25