Best thing is probably to look at attachDetach which does almost exactly the same but for the geometric matching of points and face centres.