refactor entity and xml_payload