// This method implements deleteAllBooks method of retrofit Interface.
  public void deleteAllBooks() {

    progressBar.setVisibility(ProgressBar.VISIBLE);

    RestAdapter adapter = new RestAdapter.Builder().setEndpoint(ENDPOINT).build();

    retrofitInterface retro = adapter.create(retrofitInterface.class);
    retro.deleteAllBooks(
        new Callback<Book>() {
          @Override
          public void success(Book book, Response response) {
            bookList.clear();
            updateDisplay();
            Toast.makeText(getActivity(), R.string.delete_success, Toast.LENGTH_LONG).show();
            progressBar.setVisibility(ProgressBar.GONE);
          }

          @Override
          public void failure(RetrofitError retrofitError) {
            progressBar.setVisibility(ProgressBar.GONE);
            Toast.makeText(getActivity(), R.string.delete_failed, Toast.LENGTH_LONG).show();
          }
        });
  }
  // This method uses RestAdapter and retrofit Interface to fetch and parse the JSON file.
  // Progress bar becomes visible in the beginning of the method and is gone once the is done.
  public void requestData() {

    progressBar.setVisibility(ProgressBar.VISIBLE);

    RestAdapter adapter = new RestAdapter.Builder().setEndpoint(ENDPOINT).build();

    retrofitInterface retrofit = adapter.create(retrofitInterface.class);
    retrofit.getData(
        new Callback<List<Book>>() {

          @Override
          public void success(List<Book> books, Response response) {
            bookList = books;
            progressBar.setVisibility(ProgressBar.GONE);
            updateDisplay();
          }

          @Override
          public void failure(RetrofitError retrofitError) {
            progressBar.setVisibility(ProgressBar.GONE);
            Toast.makeText(getActivity(), R.string.unable_to_fetch, Toast.LENGTH_LONG).show();
          }
        });
  }