@Override
  public Uri insert(Uri uri, ContentValues initialValues) {

    if (uriMatcher.match(uri) == UriMatcher.NO_MATCH) {
      throw new IllegalArgumentException("Unknown URI " + uri);
    }

    ContentValues values;
    if (initialValues != null) {
      values = new ContentValues(initialValues);
    } else {
      values = new ContentValues();
    }

    long rowId = 0;

    switch (uriMatcher.match(uri)) {
      case NOTE_ITEM:
        rowId =
            DatabaseHelper.getCurrentTimelineDatabase()
                .insertWithOnConflict(
                    SQLStatements.NOTE_DATABASE_TABLE_NAME,
                    NoteColumns.NOTE,
                    values,
                    SQLiteDatabase.CONFLICT_REPLACE);
        return notifyContentResolver(uri, rowId);

      case PICTURE_ITEM:
        rowId =
            DatabaseHelper.getCurrentTimelineDatabase()
                .insertWithOnConflict(
                    SQLStatements.PICTURE_DATABASE_TABLE_NAME,
                    "",
                    values,
                    SQLiteDatabase.CONFLICT_REPLACE);
        return notifyContentResolver(uri, rowId);

      case RECORDING_ITEM:
        rowId =
            DatabaseHelper.getCurrentTimelineDatabase()
                .insertWithOnConflict(
                    SQLStatements.RECORDINGS_DATABASE_TABLE_NAME,
                    "",
                    values,
                    SQLiteDatabase.CONFLICT_REPLACE);
        return notifyContentResolver(uri, rowId);
      case VIDEO_ITEM:
        rowId =
            DatabaseHelper.getCurrentTimelineDatabase()
                .insertWithOnConflict(
                    SQLStatements.VIDEO_DATABASE_TABLE_NAME,
                    "",
                    values,
                    SQLiteDatabase.CONFLICT_REPLACE);
        return notifyContentResolver(uri, rowId);

      default:
        throw new IllegalArgumentException("Unknown URI " + uri);
    }
  }
  @Override
  public int delete(Uri uri, String id, String[] whereArgs) {

    String itemID = "'" + id + "'";
    int count = 0;
    DatabaseHelper.getCurrentTimelineDatabase()
        .delete(
            SQLStatements.EVENT_TO_EVENT_ITEM_DATABASE_TABLE_NAME,
            EventItemsColumns.EVENT_ITEM_ID + "=" + itemID,
            whereArgs);

    switch (uriMatcher.match(uri)) {
      case NOTE_ITEM:
        count =
            DatabaseHelper.getCurrentTimelineDatabase()
                .delete(
                    SQLStatements.NOTE_DATABASE_TABLE_NAME,
                    BaseColumns._ID + "=" + itemID,
                    whereArgs);
        break;
      case PICTURE_ITEM:
        count =
            DatabaseHelper.getCurrentTimelineDatabase()
                .delete(
                    SQLStatements.PICTURE_DATABASE_TABLE_NAME,
                    BaseColumns._ID + "=" + itemID,
                    whereArgs);
        break;
      case RECORDING_ITEM:
        count =
            DatabaseHelper.getCurrentTimelineDatabase()
                .delete(
                    SQLStatements.RECORDINGS_DATABASE_TABLE_NAME,
                    BaseColumns._ID + "=" + itemID,
                    whereArgs);
        break;
      case VIDEO_ITEM:
        count =
            DatabaseHelper.getCurrentTimelineDatabase()
                .delete(
                    SQLStatements.VIDEO_DATABASE_TABLE_NAME,
                    BaseColumns._ID + "=" + itemID,
                    whereArgs);
        break;

      default:
        throw new IllegalArgumentException("Unknown URI " + uri);
    }
    return count;
  }
 public SQLiteDatabase getDatabase() {
   return DatabaseHelper.getCurrentTimelineDatabase();
 }