class IpcdRegistry implements PartitionListener {

   public MessageBody registerDevice(MessageBody body, String placeId) {
      logger.trace("handling register request [{}] @ [{}]", body, placeId);

      Place place = loadPlace(BridgeService.RegisterDeviceRequest.NAME, placeId);
      List<com.iris.protocol.ipcd.message.model.Device> devices = createDevicesFromBody(body);

      String protocolAddress = null;
      DeviceNotFoundException lastDnfe = null;
      PlaceMismatchException lastPme = null;
      com.iris.protocol.ipcd.message.model.Device claimedDevice = null;

      boolean alreadyPairedAtPlace = false;
      for (com.iris.protocol.ipcd.message.model.Device device : devices) {
         try {
            protocolAddress = ipcdDeviceDao.claimAndGetProtocolAddress(device, place.getAccount(), place.getId());
            if (null != protocolAddress) {
               claimedDevice = device;
               break;
            }
         } catch (DeviceNotFoundException dnfe) {
            logger.debug("[{}:{}:{}]:  failed to claim, no record exists", device.getVendor(), device.getModel(), device.getSn(), dnfe);
            lastDnfe = dnfe;
         } catch (PlaceMismatchException pme) {
            if (!Objects.equals(place.getId(), pme.getActualPlaceId())) {
               logger.debug("[{}:{}:{}]:  failed to claim ipcd device @ [{}], it has already been claimed by [{}]", device.getVendor(), device.getModel(), device.getSn(), place.getId(), pme.getActualPlaceId(), pme);
               lastPme = pme;
            } else {
               logger.debug("[{}:{}:{}]:  has already been claimed by [{}] continuing with registration", device.getVendor(), device.getModel(), device.getSn(), place.getId());
               alreadyPairedAtPlace = true;
               claimedDevice = device;
               protocolAddress = IpcdProtocol.ipcdAddress(claimedDevice).getRepresentation();
               break;
            }
         }
      }

      if (null == claimedDevice) {
         if (null != lastDnfe) {
            return Errors.fromCode(Errors.CODE_NOT_FOUND, "The ipcd device with serial number " + devices.get(0).getSn() + " could not be detected. Is it online?");
         } else if (null != lastPme) {
            return Errors.invalidRequest("The ipcd device with device id " + devices.get(0).getSn() + " is already registered. If you feel this is in error, please contact technical support.");
         }

         throw new ErrorEventException(Errors.invalidRequest("The device failed to be claimed in an unexpected fashion. Claimed device was null."));
      }

      updatePartition(protocolAddress, place.getId());
      emitClaimed(protocolAddress, place.getAccount(), place.getId(), place.getPopulation());
      issueAddDevice(claimedDevice, protocolAddress, place);
      return BridgeService.RegisterDeviceResponse.builder().withAlreadyAddedAtPlace(alreadyPairedAtPlace).build();
   }

   @Inject public  IpcdRegistry(
         IpcdRegistryConfig config,
         @Named(IpcdService.PROP_THREADPOOL) Executor executor,
         Clock clock,
         PlaceDAO placeDao,
         IpcdDeviceDao ipcdDeviceDao,
         DeviceDAO deviceDao,
         PlatformBusClient busClient,
         ProtocolMessageBus protocolBus,
         Partitioner partitioner,
         PlacePopulationCacheManager populationCacheMgr
   );

}