Source:
<code>public void fetchCurrentTheme() { WordPress.getRestClientUtilsV1_1().getCurrentTheme(mSite.getSiteId(), new Listener() { @Override public void onResponse(JSONObject response) { try { mCurrentTheme = Theme.fromJSONV1_1(response, mSite.getSiteId()); if (mCurrentTheme == null) { return; } mCurrentTheme.setIsCurrent(true); <START> WordPress.wpDB.saveTheme(mCurrentTheme); <END> WordPress.wpDB.setCurrentTheme(String.valueOf(mSite.getSiteId()), mCurrentTheme.getId()); if (mThemeBrowserFragment != null) { mThemeBrowserFragment.setRefreshing(false); if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.setRefreshing(false); } } catch (JSONException e) { AppLog.e(T.THEMES, e); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { String themeId = WordPress.wpDB.getCurrentThemeId(String.valueOf(mSite.getSiteId())); mCurrentTheme = WordPress.wpDB.getTheme(String.valueOf(mSite.getSiteId()), themeId); if (mCurrentTheme != null && mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } } } ); }</code><technical_language>this is a refactor PR, introduce a ThemeTable class move saveTheme & setCurrentTheme methods theme related queries WordPressDB there</technical_language>

Target:
public void fetchCurrentTheme() { WordPress.getRestClientUtilsV1_1().getCurrentTheme(mSite.getSiteId(), new Listener() { @Override public void onResponse(JSONObject response) { try { mCurrentTheme = Theme.fromJSONV1_1(response, mSite); if (mCurrentTheme == null) { return; } mCurrentTheme.setIsCurrent(true); ThemeTable.saveTheme(WordPress.wpDB.getDatabase(), mCurrentTheme); ThemeTable.setCurrentTheme(WordPress.wpDB.getDatabase(), String.valueOf(mSite.getSiteId()), mCurrentTheme.getId()); if (mThemeBrowserFragment != null) { mThemeBrowserFragment.setRefreshing(false); if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.setRefreshing(false); } } catch (JSONException e) { AppLog.e(T.THEMES, e); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { String themeId = ThemeTable.getCurrentThemeId(WordPress.wpDB.getDatabase(), String.valueOf(mSite.getSiteId())); mCurrentTheme = ThemeTable.getTheme(WordPress.wpDB.getDatabase(), String.valueOf(mSite.getSiteId()), themeId); if (mCurrentTheme != null && mThemeBrowserFragment != null) { if (mThemeBrowserFragment.getCurrentThemeTextView() != null) { mThemeBrowserFragment.getCurrentThemeTextView().setText(mCurrentTheme.getName()); mThemeBrowserFragment.setCurrentThemeId(mCurrentTheme.getId()); } } } } ); }