The function has local use-case only and doesn't have to be present in
class declaration. Make it a local lambda and cleanup duplicated
pointers (to parent and child of the same object)
Related-To: NEO-14742
Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>