msgmerge: extract code for each reference entry

"apply" is not best name because I feel that the method change an
object destructively. The method should not change destructively.

If we get a better name, we will change the "apply".