@WorkerThread
  public void getSpecificSection(
      Context context, int sectionPos, OnSectionDetailReadyListener listener) {

    SectionModel section = mTopSections.get(sectionPos);

    String sectionName = section.getName();

    if (CommonUtil.isEmpty(mDetailSections) || !mDetailSections.containsKey(sectionName)) {

      if (CommonUtil.checkInternetConnection(context)) {

        // try downloading data from web

        RawViaplayModel detail = null;

        try {

          detail = getSectionFromWeb(section.getUrl());

          populateSectionDetailCache(section, detail);

          returnSectionDetailToListener(sectionName, listener);

          DatabaseManager.getInstance()
              .saveDataToDb(SectionDetailModel.generateFrom(detail, section));

        } catch (IOException e) {
          Log.e(TAG, "Error while downloading section");
        }
      } else {

        // try retrieving data from db
        SectionDetailModel detail = DatabaseManager.getInstance().getSectionDetailFromDb(section);
        populateSectionDetailCache(section, detail);
        returnSectionDetailToListener(sectionName, listener);
      }

    } else {

      Log.d(TAG, "Retrieving data from cache");
      returnSectionDetailToListener(sectionName, listener);
    }
  }
  private void populateSectionDetailCache(SectionModel section, SectionDetailModel detail) {

    if (detail != null) mDetailSections.put(section.getName(), detail);
  }
  private void populateSectionDetailCache(SectionModel section, RawViaplayModel rawModel) {

    mDetailSections.put(section.getName(), SectionDetailModel.generateFrom(rawModel, section));
  }
  private void populateTopSectionsCache(RawViaplayModel rawModel) {

    for (RawViaplaySectionModel rawSection : rawModel.getSections())
      mTopSections.add(SectionModel.generateFrom(rawSection));
  }