Fix serialization/deserialization.
Add sorting to pagination.