code: @Override
      public int executeBatch()
      {
          Map<String, BulkWriteOperation> bulkWriteOperationMap = new HashMap<String, BulkWriteOperation>();
          int size = 0;
          for (Node node : nodes)
          {
              if (node.isDirty())
              {
                  node.handlePreEvent();
                  // delete can not be executed in batch
                  if (node.isInState(RemovedState.class))
                  {
                      delete(node.getData(), node.getEntityId());
                  }
                  else
                  {
                      List<RelationHolder> relationHolders = getRelationHolders(node);
                      EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata,
                              node.getDataClass());
                      Map<String, DBObject> documents = handler.getDocumentFromEntity(metadata, node.getData(),
                              relationHolders, kunderaMetadata);
                      for (String tableName : documents.keySet())
                      {
                          if (!bulkWriteOperationMap.containsKey(tableName))
                          {
                              DBCollection collection = mongoDb.getCollection(tableName);
                              BulkWriteOperation builder = null;
                              if (isOrderedBulkOperation())
                              {
                                  builder = collection.initializeOrderedBulkOperation();
                              }
                              else
                              {
                                  builder = collection.initializeUnorderedBulkOperation();
                              }
                              bulkWriteOperationMap.put(tableName, builder);
                          }
  
                          if (!node.isUpdate())
                          {
                              bulkWriteOperationMap.get(tableName).insert(documents.get(tableName));
                          }
  
                          else
                          {
                              bulkWriteOperationMap.get(tableName).find(new BasicDBObject("_id", node.getEntityId()))
                                      .upsert().replaceOne(documents.get(tableName));
                          }
                          size++;
                      }
                      indexNode(node, metadata);
                  }
                  node.handlePostEvent();
              }
          }
          onFlushBatch(bulkWriteOperationMap);
          return size;
      }
docs: /*
  (non-Javadoc)
  
  @see com.impetus.kundera.persistence.api.Batcher#executeBatch()