public static List<Card> parseTextToCards(String input) throws ParseException {
        List<Card> cards = new ArrayList<Card>();
        if (input == null || input.isEmpty()) {
            return cards;
        }        
        Map<String, Rank> stringToRankMap = Rank.getStringToRankMap();
        Map<String, Suit> stringToSuitMap = Suit.getStringToSuitMap();
        
        String[] cardStrings = input.split(",");
        
        for (int i = 0; i < cardStrings.length; i++) {
            String cardString = cardStrings[i].trim();
            if (cardString.length() != 2) {
                throw new ParseException("Cardstring " + i + " has a length other than two.", i);
            }
            Rank rank = stringToRankMap.get(Character.toString(cardString.charAt(0)));
            Suit suit = stringToSuitMap.get(Character.toString(cardString.charAt(1))); 
            if (rank == null) {
                throw new ParseException("Invalid rank in cardstring " + i, i);
            }
            if (suit == null) {
                throw new ParseException("Invalid suit in cardstring " + i, i);                
            }
            Card card = new Card(suit, rank);
            
            if (!cards.contains(card)) {
                cards.add(card);
            } else {
                throw new ParseException("The same card can't be added twice to the list", i);
            }
        }
        
        return cards;
    }