@Override
  public CommandProcessingResult updateLoanTaxMap(JsonCommand command) {

    final JsonElement parsedJson = this.fromJsonHelper.parse(command.json());

    if (parsedJson.isJsonObject()) {

      final JsonObject topLevelJsonElement = parsedJson.getAsJsonObject();

      final Long loanId = this.fromJsonHelper.extractLongNamed("loanId", topLevelJsonElement);

      if (topLevelJsonElement.has("taxArray")
          && topLevelJsonElement.get("taxArray").isJsonArray()) {

        final JsonArray array = topLevelJsonElement.get("taxArray").getAsJsonArray();

        for (int i = 0; i < array.size(); i++) {
          final JsonObject loanChargeElement = array.get(i).getAsJsonObject();
          final Long taxMapId = this.fromJsonHelper.extractLongNamed("taxMapId", loanChargeElement);
          LoanTaxMap loanTaxMap = this.loanTaxMapRepository.findOne(taxMapId);
          loanTaxMap.updateLoanId(loanId);
          this.loanTaxMapRepository.save(loanTaxMap);
        }
      }

      return new CommandProcessingResultBuilder().withEntityId(loanId).build();
    }

    return null;
  }
  @Override
  public CommandProcessingResult deleteLoanTaxMapId(Long loanId, JsonCommand command) {

    List<LoanTaxMap> loanTaxMaps = this.loanTaxMapRepository.findByLoanId(loanId);

    for (LoanTaxMap loanTaxMap : loanTaxMaps) {
      this.loanTaxMapRepository.delete(loanTaxMap.getId());
    }

    return new CommandProcessingResultBuilder().withEntityId(loanId).build();
  }