rewrite relay saving/handling so that we validate and save as expected

Bug #77537