protected PsiElement addToMethodCallLocation(PsiStatement newStatement) throws IncorrectOperationException {
    if (myAddedToMethodCallLocation != null) {
      PsiCodeBlock block = myAddedToMethodCallLocation.getCodeBlock();
      return block.addBefore(newStatement, block.getRBrace());
    }

    PsiElement location;
    PsiStatement oldStatement;
    if (myEnclosingBlockStatement != null) {
      location = oldStatement = myEnclosingBlockStatement;
    }
    else {
      PsiElement element = myExpression != null ? myExpression : myElements[0];
      PsiComment comment = PsiTreeUtil.getParentOfType(element, PsiComment.class, false);

      if (comment == null) {
        location = oldStatement = PsiTreeUtil.getParentOfType(element, PsiStatement.class, false);
      }
      else {
        location = comment;
        oldStatement = StreamEx.of(myElements)
          .filter(e -> !(e instanceof PsiComment) && !(e instanceof PsiWhiteSpace))
          .map(e -> PsiTreeUtil.getParentOfType(e, PsiStatement.class, false))
          .nonNull()
          .findFirst()
          .orElse(null);
      }
    }

    LOG.assertTrue(location != null, "Can't find statement/comment at the extracted location");

    PsiElement parent = location.getParent();
    if (isBranchOrBody(parent, oldStatement)) {
      // The parent statement will be inconsistent until deleting the extracted part:
      // the block statement is being added just before a then/else branch or loop body,
      // but the original then/else branch or loop body will be deleted in the end so it's fine.
      // Example: "if(..) oldStatement" -> "if(..) { newStatement } oldStatement" -> "if(..) { newStatement }"
      myAddedToMethodCallLocation = (PsiBlockStatement)myElementFactory.createStatementFromText("{}", oldStatement);
      myAddedToMethodCallLocation = (PsiBlockStatement)parent.addBefore(myAddedToMethodCallLocation, location);
      PsiCodeBlock block = myAddedToMethodCallLocation.getCodeBlock();
      return block.addBefore(newStatement, block.getRBrace());
    }
    return parent.addBefore(newStatement, location);
  }
protected PsiElement addToMethodCallLocation(PsiStatement newStatement)