Instead of this if-else, maybe `xml_to_hash` should be idempotent on Hash-likes (and renamed appropriately).  Then these five lines can become one.  `parameters = to_hash_payload(payload).values.first`.