Add a method to merge two trajectories taking care when merging labels