Refactor and added support for insert parent and parent replicate.