@Transactional
  @Override
  public CommandProcessingResult deleteApplication(final Long savingsId) {

    final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId);
    checkClientOrGroupActive(account);

    if (account.isNotSubmittedAndPendingApproval()) {
      final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
      final DataValidatorBuilder baseDataValidator =
          new DataValidatorBuilder(dataValidationErrors)
              .resource(
                  SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.deleteApplicationAction);

      baseDataValidator
          .reset()
          .parameter(SavingsApiConstants.activatedOnDateParamName)
          .failWithCodeNoParameterAddedToErrorCode("not.in.submittedandpendingapproval.state");

      if (!dataValidationErrors.isEmpty()) {
        throw new PlatformApiDataValidationException(dataValidationErrors);
      }
    }

    final List<Note> relatedNotes = this.noteRepository.findBySavingsAccountId(savingsId);
    this.noteRepository.deleteInBatch(relatedNotes);

    this.savingAccountRepository.delete(account);

    return new CommandProcessingResultBuilder() //
        .withEntityId(savingsId) //
        .withOfficeId(account.officeId()) //
        .withClientId(account.clientId()) //
        .withGroupId(account.groupId()) //
        .withSavingsId(savingsId) //
        .build();
  }