private static boolean prepareForWrite(PsiFile file, List<UsageInfo> usages) {
    List<PsiElement> toWrite = ContainerUtil.prepend(ContainerUtil.mapNotNull(usages, UsageInfo::getElement), file);
    if (!FileModificationService.getInstance().preparePsiElementsForWrite(toWrite)) return false;
    return true;
  }
private static boolean prepareForWrite(PsiFile file, List<UsageInfo> usages)