Separate equal code to subfunctions. Especially to get a better basic for bug# 3075. Simpify code.
Separate equal code to subfunctions. Especially to get a better basic for bug# 3075. Simpify code.

djoudi/otrs-gitimport-test,djoudi/otrs-gitimport-test,djoudi/otrs-gitimport-test