Remove code duplication in finding FrameTrees with a given pipeline id.