MODE-2294: Make server side classes serializable

Adds serialization to the server side classes.
See my comment above, re the issues with `LRepository` being serializable.