@Override
  public Uri insert(Uri uri, ContentValues initialValues) {
    if (sUriMatcher.match(uri) != DEVICES) {
      throw new IllegalArgumentException("Unknown URI " + uri);
    }

    ContentValues values;
    if (initialValues != null) {
      values = new ContentValues(initialValues);
    } else {
      values = new ContentValues();
    }
    String json = DeviceProcessor.toJSON(values);
    String response = RESTMethod.post(URL + "/devices/create", json);
    if (!"".equals(response)) {
      values = DeviceProcessor.parseJSON(response);
    }
    SQLiteDatabase db = dbHelper.getWritableDatabase();
    long rowId = db.insert(DEVICES_TABLE_NAME, Devices.LOCATION, values);
    if (rowId > 0) {
      Uri noteUri = ContentUris.withAppendedId(Devices.CONTENT_URI, rowId);
      getContext().getContentResolver().notifyChange(noteUri, null);
      return noteUri;
    }
    throw new SQLException("Failed to insert row into " + uri);
  }