class LdapUtils {

    public static LdapName removeFirst(Name dn, Name pathToRemove) {
        Assert.notNull(dn, "dn must not be null");
        Assert.notNull(pathToRemove, "pathToRemove must not be null");

        LdapName result = newLdapName(dn);
        LdapName path = returnOrConstructLdapNameFromName(pathToRemove);

        if(path.size() == 0 || !dn.startsWith(path)) {
            return result;
        }

        for(int i = 0; i < path.size(); i++) {
            try {
                result.remove(0);
            } catch (InvalidNameException e) {
                throw convertLdapException(e);
            }
        }

        return result;
    }

    private  LdapUtils();

}