title: How to check if the user has been added to LDAP group using springboot
body: <p>I need to validate if the user has been added successfully to a particular group. The only option I can think of is using exception handling. Is there a better way of using LDAP response codes of any type.</p>
  <pre><code>public boolean addMemberToGroup(String groupName, Person p) {
          boolean status = false;
          Name groupDn = buildGroupDn(groupName);
          Name personDn = buildPersonDn(p);
          try {
              
              DirContextOperations ctx = ldapTemplate.lookupContext(groupDn);
              ctx.addAttributeValue(UNIQUE_MEMBER, personDn);
              ldapTemplate.modifyAttributes(ctx);
              status  = true;
          }catch (Exception e) {
              status =false;
          }
          return status;
      }
  </code></pre>