@Override
    final protected CounterParty addBusinessObject(BusinessObject value, Map<String,String> keyMap) throws EmptyNameException, DuplicateNameException {
        CounterParty counterParty = (CounterParty)value;
        if(counterParty.getName()==null || "".equals(counterParty.getName().trim())){
            throw new EmptyNameException();
        }

        // check for duplicate Accounts
        for(Map.Entry<String,String> entry:keyMap.entrySet()){
            String type = entry.getKey();
            String key = entry.getValue();

            TreeMap<String, BusinessObject> map = dataTables.get(type);
            CounterParty foundValue = (CounterParty)map.get(key);

            if(foundValue!=null){
                if(counterParty.isMergeable()){
                    // update Accounts
                    counterParty = merge(foundValue, counterParty);
//                } else {
//                    throw new DuplicateNameException();
                }
            } else {
                map.put(key, counterParty);
            }
        }
        CounterParty foundByName = (CounterParty)getBusinessObject(counterParty.getName());
        if(foundByName!=null){
            if(counterParty.isMergeable()){
                counterParty = merge(foundByName,counterParty);
            } else {
                throw new DuplicateNameException();
            }
        }
        dataTables.get(NAME).put(counterParty.getName(),counterParty);


        return counterParty;
    }