Fixed the issue with the parent already created before. Added test for it.