private static PsiMethodCallExpression getRootMethodCallExpression(PsiMethodCallExpression expression) {
    final PsiReferenceExpression methodExpression = expression.getMethodExpression();
    final PsiExpression qualifierExpression = PsiUtil.skipParenthesizedExprDown(methodExpression.getQualifierExpression());
    if (qualifierExpression instanceof PsiMethodCallExpression methodCallExpression) {
      return getRootMethodCallExpression(methodCallExpression);
    }
    return expression;
  }
private static PsiMethodCallExpression getRootMethodCallExpression(PsiMethodCallExpression expression)