serialize two classes.