public static MobileDevice convertToMobileDevice(Device device) {
    MobileDevice mobileDevice = null;
    if (device != null) {
      mobileDevice = new MobileDevice();
      mobileDevice.setMobileDeviceId(device.getDeviceIdentifier());
      mobileDevice.setImei(getPropertyValue(device, MOBILE_DEVICE_IMEI));
      mobileDevice.setImsi(getPropertyValue(device, MOBILE_DEVICE_IMSI));
      mobileDevice.setModel(getPropertyValue(device, MOBILE_DEVICE_MODEL));
      mobileDevice.setOsVersion(getPropertyValue(device, MOBILE_DEVICE_OS_VERSION));
      mobileDevice.setVendor(getPropertyValue(device, MOBILE_DEVICE_VENDOR));
      mobileDevice.setLatitude(getPropertyValue(device, MOBILE_DEVICE_LATITUDE));
      mobileDevice.setLongitude(getPropertyValue(device, MOBILE_DEVICE_LONGITUDE));
      mobileDevice.setSerial(getPropertyValue(device, MOBILE_DEVICE_SERIAL));
      mobileDevice.setOsBuildDate(getPropertyValue(device, MOBILE_DEVICE_OS_BUILD_DATE));

      if (device.getProperties() != null) {
        Map<String, String> deviceProperties = new HashMap<String, String>();
        for (Device.Property deviceProperty : device.getProperties()) {
          deviceProperties.put(deviceProperty.getName(), deviceProperty.getValue());
        }

        mobileDevice.setDeviceProperties(deviceProperties);
      } else {
        mobileDevice.setDeviceProperties(new HashMap<String, String>());
      }
    }
    return mobileDevice;
  }