private long tryGetNumberOfNextToDocumentPage(long pagesAmountInFile) {
    if (documentOfPagesModel.getPagesAmount() > 0) {
      long nextPageNumber = documentOfPagesModel.getLastPage().getPageNumber() + 1;
      return nextPageNumber < pagesAmountInFile ? nextPageNumber : -1;
    }
    else {
      return -1;
    }
  }
private long tryGetNumberOfNextToDocumentPage(long pagesAmountInFile)