Refactoring to aloja-import2db functionality