class InstalledAppProvider extends FDroidProvider {

    @Override
    public Uri insert(@NonNull Uri uri, ContentValues values) {

        if (MATCHER.match(uri) != CODE_LIST) {
            throw new UnsupportedOperationException("Insert not supported for " + uri + ".");
        }

        if (!values.containsKey(Cols.Package.NAME)) {
            throw new IllegalStateException("Package name not provided to InstalledAppProvider");
        }

        String packageName = values.getAsString(Cols.Package.NAME);
        long packageId = PackageProvider.Helper.ensureExists(getContext(), packageName);
        values.remove(Cols.Package.NAME);
        values.put(Cols.PACKAGE_ID, packageId);

        verifyVersionNameNotNull(values);

        db().replaceOrThrow(getTableName(), null, values);

        AppProvider.Helper.calcSuggestedApk(getContext(), packageName);

        return getAppUri(values.getAsString(Cols.Package.NAME));
    }

}