breaking apart the serialize function in model