@POST
  public XmlsonObject create(
      @Context WesabeUser user,
      @Context Locale locale,
      @PathParam("accountId") IntegerParam accountId,
      @FormParam("balance") DecimalParam balance) {

    if (balance == null) {
      throw new WebApplicationException(
          Response.status(Status.BAD_REQUEST).entity("balance is required").build());
    }

    final Account account = accountDAO.findAccount(user.getAccountKey(), accountId.getValue());

    if (account == null) {
      throw new WebApplicationException(Status.NOT_FOUND);
    }

    if (!account.hasBalance()) {
      throw new WebApplicationException(
          Response.status(Status.BAD_REQUEST)
              .entity(
                  String.format(
                      "%s accounts do not have balances", account.getAccountType().toString()))
              .build());
    }

    final AccountBalance accountBalance =
        new AccountBalance(account, balance.getValue(), new DateTime());

    accountBalanceDAO.create(accountBalance);

    return presenter.present(accountBalance, locale);
  }
  @GET
  public XmlsonArray list(
      @Context WesabeUser user,
      @Context Locale locale,
      @PathParam("accountId") IntegerParam accountId) {

    final XmlsonArray result = new XmlsonArray("account-balances");
    final Account account = accountDAO.findAccount(user.getAccountKey(), accountId.getValue());

    if (account.hasBalance()) {
      for (AccountBalance accountBalance : account.getAccountBalances()) {
        result.add(presenter.present(accountBalance, locale));
      }
    }

    return result;
  }