public OlePatronLoanDocuments(Builder builder) {

    this.olePatronLoanItem = new ArrayList<OlePatronLoanDocument>();
    if (!CollectionUtils.isEmpty(builder.getOlePatronLoanDocuments())) {
      for (OlePatronLoanDocument.Builder olePatronLoanDocument :
          builder.getOlePatronLoanDocuments()) {
        this.olePatronLoanItem.add(olePatronLoanDocument.build());
      }
    }
  }
    public static Builder create(OlePatronLoanDocumentsContract contract) {

      if (contract == null) {
        throw new IllegalArgumentException("contract was null");
      }
      Builder builder = create();

      builder.olePatronLoanDocuments = new ArrayList<OlePatronLoanDocument.Builder>();
      if (!CollectionUtils.isEmpty(contract.getOlePatronLoanDocuments())) {
        for (OlePatronLoanDocumentContract olePatronLoanDocumentContract :
            contract.getOlePatronLoanDocuments()) {
          builder.olePatronLoanDocuments.add(
              OlePatronLoanDocument.Builder.create(olePatronLoanDocumentContract));
        }
      }

      builder.setVersionNumber(contract.getVersionNumber());

      // builder.setId(contract.getId());

      return builder;
    }
 /**
  * This method converts the PersistableBusinessObjectBase OlePatronDocument into immutable object
  * OlePatronDefinition
  *
  * @param bo
  * @return OlePatronDefinition
  */
 public static OlePatronLoanDocument to(OleRenewalLoanDocument bo) {
   if (bo == null) {
     return null;
   }
   return OlePatronLoanDocument.Builder.create(bo).build();
 }