Add serialization for Pagination objects

* Also adds test cases for pagination