refactoring executor and adding unit test case for service to insert into nested tables