private boolean isDataMissing(final Exception e) {
    boolean dataMissing = false;
    if (e instanceof RestconfDocumentedException) {
      final RestconfDocumentedException rde = (RestconfDocumentedException) e;
      if (!rde.getErrors().isEmpty()) {
        if (rde.getErrors().get(0).getErrorTag() == ErrorTag.DATA_MISSING) {
          dataMissing = true;
        }
      }
    }

    return dataMissing;
  }
  public PATCHStatusContext patchConfigurationDataWithinTransaction(
      final PATCHContext context, final SchemaContext globalSchema) {
    final DOMDataReadWriteTransaction patchTransaction = domDataBroker.newReadWriteTransaction();
    List<PATCHStatusEntity> editCollection = new ArrayList<>();
    List<RestconfError> editErrors;
    List<RestconfError> globalErrors = null;
    int errorCounter = 0;

    for (PATCHEntity patchEntity : context.getData()) {
      final PATCHEditOperation operation =
          PATCHEditOperation.valueOf(patchEntity.getOperation().toUpperCase());

      switch (operation) {
        case CREATE:
          if (errorCounter == 0) {
            try {
              postDataWithinTransaction(
                  patchTransaction,
                  CONFIGURATION,
                  patchEntity.getTargetNode(),
                  patchEntity.getNode(),
                  globalSchema);
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), true, null));
            } catch (RestconfDocumentedException e) {
              editErrors = new ArrayList<>();
              editErrors.addAll(e.getErrors());
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), false, editErrors));
              errorCounter++;
            }
          }
          break;
        case REPLACE:
          if (errorCounter == 0) {
            try {
              putDataWithinTransaction(
                  patchTransaction,
                  CONFIGURATION,
                  patchEntity.getTargetNode(),
                  patchEntity.getNode(),
                  globalSchema);
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), true, null));
            } catch (RestconfDocumentedException e) {
              editErrors = new ArrayList<>();
              editErrors.addAll(e.getErrors());
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), false, editErrors));
              errorCounter++;
            }
          }
          break;
        case DELETE:
          if (errorCounter == 0) {
            try {
              deleteDataWithinTransaction(
                  patchTransaction, CONFIGURATION, patchEntity.getTargetNode());
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), true, null));
            } catch (RestconfDocumentedException e) {
              editErrors = new ArrayList<>();
              editErrors.addAll(e.getErrors());
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), false, editErrors));
              errorCounter++;
            }
          }
          break;
        case REMOVE:
          if (errorCounter == 0) {
            try {
              deleteDataWithinTransaction(
                  patchTransaction, CONFIGURATION, patchEntity.getTargetNode());
              editCollection.add(new PATCHStatusEntity(patchEntity.getEditId(), true, null));
            } catch (RestconfDocumentedException e) {
              LOG.error(
                  "Error removing {} by {} operation",
                  patchEntity.getTargetNode().toString(),
                  patchEntity.getEditId(),
                  e);
            }
          }
          break;
      }
    }

    // TODO: make sure possible global errors are filled up correctly and decide transaction
    // submission based on that
    // globalErrors = new ArrayList<>();
    if (errorCounter == 0) {
      final CheckedFuture<Void, TransactionCommitFailedException> submit =
          patchTransaction.submit();
      return new PATCHStatusContext(
          context.getPatchId(), ImmutableList.copyOf(editCollection), true, globalErrors);
    } else {
      patchTransaction.cancel();
      return new PATCHStatusContext(
          context.getPatchId(), ImmutableList.copyOf(editCollection), false, globalErrors);
    }
  }