Clean up swap_realm_ids and eliminate swap_app_ids