migratebundle: factor relation filtering into its own function