Encapsulate general code + let user serielize the data
Adapt server example to latest change