public void checkRegistryObjectLid(RegistryObjectType ro) throws RegistryException {
    String id = ro.getId();
    String lid = ro.getLid();

    String existingObjectLid = (String) context.getIdToLidMap().get(id);

    // Assign lid if not specified, validate lid if specified
    if (existingObjectLid != null) {
      if (lid == null) {
        ro.setLid(existingObjectLid);
      } else {
        // Validate that lid matches existing objects lid
        if (!lid.equals(existingObjectLid)) {
          throw new RegistryException(
              ServerResourceBundle.getInstance()
                  .getString("message.idDoesNotMatch", new Object[] {lid, existingObjectLid, id}));
        }
      }
    } else {
      checkRegistryObjectLidOnNewObject(ro);
    }
  }