Move handle_serialization_error to Resource