/**
             * Handle deleting data.
             */
            public override int Delete(Uri uri, string where, string[] whereArgs)
            {
                SQLiteDatabase db = mOpenHelper.GetWritableDatabase();
                string         constWhere;

                int count;

                switch (mUriMatcher.Match(uri))
                {
                case MAIN:
                    // If URI is main table, delete uses incoming where clause and args.
                    count = db.Delete(MainTable.TABLE_NAME, where, whereArgs);
                    break;

                // If the incoming URI matches a single note ID, does the delete based on the
                // incoming data, but modifies the where clause to restrict it to the
                // particular note ID.
                case MAIN_ID:
                    // If URI is for a particular row ID, delete is based on incoming
                    // data but modified to restrict to the given ID.
                    constWhere = DatabaseUtilsCompat.ConcatenateWhere(
                        IBaseColumnsConstants._ID + " = " + Android_Content.ContentUris.ParseId(uri), where);
                    count = db.Delete(MainTable.TABLE_NAME, constWhere, whereArgs);
                    break;

                default:
                    throw new System.ArgumentException("Unknown URI " + uri);
                }

                Context.GetContentResolver().NotifyChange(uri, null);

                return(count);
            }
            /**
             * Handle updating data.
             */
            public override int Update(Uri uri, Android_Content.ContentValues values, string where, string[] whereArgs)
            {
                SQLiteDatabase db = mOpenHelper.GetWritableDatabase();
                int count;
                string constWhere;

                switch (mUriMatcher.Match(uri)) {
                    case MAIN:
                        // If URI is main table, update uses incoming where clause and args.
                        count = db.Update(MainTable.TABLE_NAME, values, where, whereArgs);
                        break;

                    case MAIN_ID:
                        // If URI is for a particular row ID, update is based on incoming
                        // data but modified to restrict to the given ID.
                        constWhere = DatabaseUtilsCompat.ConcatenateWhere(
                                IBaseColumnsConstants._ID + " = " + Android_Content.ContentUris.ParseId(uri), where);
                        count = db.Update(MainTable.TABLE_NAME, values, constWhere, whereArgs);
                        break;

                    default:
                        throw new System.ArgumentException("Unknown URI " + uri);
                }

                GetContext().GetContentResolver().NotifyChange(uri, null);

                return count;
            }
            /**
             * Handle incoming queries.
             */
            public override ICursor Query(Uri uri, string[] projection, string selection,
                                          string[] selectionArgs, string sortOrder)
            {
                // Constructs a new query builder and sets its table name
                SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

                qb.SetTables(MainTable.TABLE_NAME);

                switch (mUriMatcher.Match(uri))
                {
                case MAIN:
                    // If the incoming URI is for main table.
                    qb.SetProjectionMap(mNotesProjectionMap);
                    break;

                case MAIN_ID:
                    // The incoming URI is for a single row.
                    qb.SetProjectionMap(mNotesProjectionMap);
                    qb.AppendWhere(IBaseColumnsConstants._ID + "=?");
                    selectionArgs = DatabaseUtilsCompat.AppendSelectionArgs(selectionArgs,
                                                                            new string[] { uri.GetLastPathSegment() });
                    break;

                default:
                    throw new System.ArgumentException("Unknown URI " + uri);
                }


                if (TextUtils.IsEmpty(sortOrder))
                {
                    sortOrder = MainTable.DEFAULT_SORT_ORDER;
                }

                SQLiteDatabase db = mOpenHelper.GetReadableDatabase();

                ICursor c = qb.Query(db, projection, selection, selectionArgs,
                                     null /* no group */, null /* no filter */, sortOrder);

                c.SetNotificationUri(Context.GetContentResolver(), uri);
                return(c);
            }