We use while loops like this just in case there are multiple results returned. In the case where we only expect 1 row these could be changed to if statements. We should log if there are multiple rows returned when we only expect one but there's no need to do that in this merge.