private boolean wasReferenceChanged(@NotNull PsiTreeChangeEvent event) {
    PsiElement oldChild = event.getOldChild();
    if (oldChild != null && hasReferenceInside(oldChild)) {
      return true;
    }
    PsiElement newChild = event.getNewChild();
    if (newChild != null && newChild != oldChild && hasReferenceInside(newChild)) {
      return true;
    }
    PsiElement child = event.getChild();
    boolean result = child != null && child != oldChild && child != newChild && hasReferenceInside(child);
    return result;
  }
private boolean wasReferenceChanged(@NotNull PsiTreeChangeEvent event)