public static Device convertToDevice(MobileDevice mobileDevice) {
    Device device = null;
    if (mobileDevice != null) {
      device = new Device();
      List<Device.Property> propertyList = new ArrayList<Device.Property>();
      propertyList.add(getProperty(MOBILE_DEVICE_IMEI, mobileDevice.getImei()));
      propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi()));
      propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel()));
      propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion()));
      propertyList.add(getProperty(MOBILE_DEVICE_OS_BUILD_DATE, mobileDevice.getOsBuildDate()));
      propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor()));
      if (mobileDevice.getLatitude() != null) {
        propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude()));
      }
      if (mobileDevice.getLongitude() != null) {
        propertyList.add(getProperty(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude()));
      }
      propertyList.add(getProperty(MOBILE_DEVICE_SERIAL, mobileDevice.getSerial()));

      if (mobileDevice.getDeviceProperties() != null) {
        for (Map.Entry<String, String> deviceProperty :
            mobileDevice.getDeviceProperties().entrySet()) {
          propertyList.add(getProperty(deviceProperty.getKey(), deviceProperty.getValue()));
        }
      }

      device.setProperties(propertyList);
      device.setDeviceIdentifier(mobileDevice.getMobileDeviceId());
    }
    return device;
  }