public final void handleNewMessages(final FermatMessage fermatMessage) {

    try {

      final Gson gson = new Gson();

      final String jsonMessage = fermatMessage.getContent();

      final NetworkServiceMessage networkServiceMessage =
          gson.fromJson(jsonMessage, NetworkServiceMessage.class);

      switch (networkServiceMessage.getMessageType()) {
        case INFORMATION:
          // update the request to processing receive state with the given action.
          final InformationMessage informationMessage =
              gson.fromJson(jsonMessage, InformationMessage.class);
          receiveInformationMessage(informationMessage);
          System.out.println(
              " CPR NS - Information Message Received: " + informationMessage.toString());
          break;
        case REQUEST:
          // create the request in processing receive state.
          final RequestMessage requestMessage = gson.fromJson(jsonMessage, RequestMessage.class);
          receiveCryptoPaymentRequest(requestMessage);
          System.out.println(" CPR NS - Request Message Received: " + requestMessage.toString());
          break;
      }

    } catch (Exception e) {
      reportUnexpectedException(e);
    }
  }
  private void receiveInformationMessage(InformationMessage informationMessage)
      throws CantReceiveInformationMessageException {
    try {

      cryptoPaymentRequestNetworkServiceDao.takeAction(
          informationMessage.getRequestId(),
          informationMessage.getAction(),
          RequestProtocolState.PENDING_ACTION);

    } catch (CantTakeActionException | RequestNotFoundException e) {
      // i inform to error manager the error.
      reportUnexpectedException(e);
      throw new CantReceiveInformationMessageException(
          e, "", "Error in Crypto Payment Request NS Dao.");
    } catch (Exception e) {

      reportUnexpectedException(e);
      throw new CantReceiveInformationMessageException(e, "", "Unhandled Exception.");
    }
  }