move serialize to APIBaseHandler