protected function getNewRealDepth($ancestor)
    {
        if (!$ancestor instanceof EntityInterface) {
            if (is_null($ancestor)) {
                return 0;
            } else {
                return static::find($ancestor)->real_depth + 1;
            }
        } else {
            return $ancestor->real_depth + 1;
        }
    }