code: public void store(Entry entry) throws EntryAlreadyExistsException, MissingParentException {
          AddRequest addRequest = new AddRequestImpl().setEntry(entry);
          LdapResult result;
          try {
              result = connection.add(addRequest).getLdapResult();
          } catch (LdapException e) {
              throw new LdapDaoException(e);
          }
          if (result.getResultCode() == ResultCodeEnum.ENTRY_ALREADY_EXISTS) {
              throw new EntryAlreadyExistsException(entry);
          } else if (result.getResultCode() == ResultCodeEnum.NO_SUCH_OBJECT) {
              throw new MissingParentException(lastMatch(entry.getDn()));
          } else if (result.getResultCode() != ResultCodeEnum.SUCCESS) {
              throw new LdapDaoException(result.getDiagnosticMessage());
          }
      }
docs: Inserts an entry into the DIT. Throws {@link EntryAlreadyExistsException} if an entry with given Dn already
  exists. Throws {@link MissingParentException} if an ancestor of the entry is missing.