Add methods for serializing resultset and relation