private void getOptionSetDataFromServer() throws ApiException {
    ResourceType resource = ResourceType.OPTION_SETS;
    DateTime serverTime = systemInfoApiClient.getSystemInfo().getServerDate();
    DateTime lastUpdated = lastUpdatedPreferences.get(resource);
    List<OptionSet> allOptionSets = optionSetApiClient.getBasicOptionSets(null);
    List<OptionSet> updatedOptionSets = optionSetApiClient.getFullOptionSets(lastUpdated);
    linkOptionsWithOptionSets(updatedOptionSets);
    List<OptionSet> existingPersistedAndUpdatedOptionSets =
        modelUtils.merge(allOptionSets, updatedOptionSets, mOptionSetStore.queryAll());

    List<IDbOperation> operations = new ArrayList<>();
    List<OptionSet> persistedOptionSets = mOptionSetStore.queryAll();
    if (existingPersistedAndUpdatedOptionSets != null
        && !existingPersistedAndUpdatedOptionSets.isEmpty()) {
      for (OptionSet optionSet : existingPersistedAndUpdatedOptionSets) {
        if (optionSet == null || optionSet.getOptions() == null) {
          continue;
        }
        OptionSet persistedOptionSet = mOptionSetStore.queryByUid(optionSet.getUId());
        List<Option> persistedOptions;
        if (persistedOptionSet != null) {
          persistedOptions = persistedOptionSet.getOptions();
        } else {
          persistedOptions = new ArrayList<>();
        }
        operations.addAll(
            transactionManager.createOperations(
                mOptionStore, persistedOptions, optionSet.getOptions()));
      }
    }
    operations.addAll(
        transactionManager.createOperations(
            mOptionSetStore, persistedOptionSets, existingPersistedAndUpdatedOptionSets));

    //        DbUtils.applyBatch(operations);
    transactionManager.transact(operations);
    lastUpdatedPreferences.save(ResourceType.OPTION_SETS, serverTime);
  }
  public void postInterpretation(Interpretation interpretation) throws ApiException {
    try {
      Response response;

      switch (interpretation.getType()) {
          /* case Interpretation.TYPE_CHART: {
              response = mDhisApi.postChartInterpretation(
                      interpretation.getChart().getUId(), new TypedString(interpretation.getText()));
              break;
          }
          case Interpretation.TYPE_MAP: {
              response = mDhisApi.postMapInterpretation(
                      interpretation.getMap().getUId(), new TypedString(interpretation.getText()));
              break;
          }
          case Interpretation.TYPE_REPORT_TABLE: {
              response = mDhisApi.postReportTableInterpretation(
                      interpretation.getReportTable().getUId(), new TypedString(interpretation.getText()));
              break;
          }
          default:
              throw new IllegalArgumentException("Unsupported interpretation type");
          */
      }

      /* Header header = NetworkUtils.findLocationHeader(response.getHeaders());
      String interpretationUid = Uri.parse(header
              .getValue()).getLastPathSegment(); */
      //  interpretation.setUId(interpretationUid);
      // interpretation.setAction(Action.SYNCED);

      mInterpretationStore.save(interpretation);

      updateInterpretationTimeStamp(interpretation);

    } catch (ApiException apiException) {
      // ApiExceptionHandler.handleApiException(apiException, interpretation, mInterpretationStore);
    }
  }