extract similar code into get_by_app_attr