public Customer updateOrSaveAddressCustomer(final RequestData requestData, final Market market, final MarketArea marketArea, final CustomerAddressForm customerAddressForm) throws Exception {
final HttpServletRequest request = requestData.getRequest();
String customerLogin = requestUtil.getCurrentCustomerLogin(request);
Customer customer = customerService.getCustomerByLoginOrEmail(customerLogin);
CustomerAddress customerAddress = new CustomerAddress();
String addressId = customerAddressForm.getIdOrGuid();
if(StringUtils.isNotEmpty(addressId)){
customerAddress = customer.getAddress(new Long(addressId));
}
if(StringUtils.isNotEmpty(customerAddressForm.getAddressName())){
customerAddress.setAddressName(customerAddressForm.getAddressName());
} else {
customerAddress.setAddressName(customerAddressForm.getAddress1() + "(" + customerAddressForm.getCity() + ")");
}
customerAddress.setAddressName(customerAddressForm.getAddressName());
customerAddress.setTitle(customerAddressForm.getTitle());
customerAddress.setLastname(customerAddressForm.getLastname());
customerAddress.setFirstname(customerAddressForm.getFirstname());
customerAddress.setAddress1(customerAddressForm.getAddress1());
customerAddress.setAddress2(customerAddressForm.getAddress2());
customerAddress.setAddressAdditionalInformation(customerAddressForm.getAddressAdditionalInformation());
customerAddress.setPostalCode(customerAddressForm.getPostalCode());
customerAddress.setCity(customerAddressForm.getCity());
customerAddress.setStateCode(customerAddressForm.getStateCode());
customerAddress.setCountryCode(customerAddressForm.getCountryCode());
customerAddress.setDefaultBilling(true);
customerAddress.setDefaultShipping(true);
if(StringUtils.isEmpty(addressId)){
customer.getAddresses().add(customerAddress);
}