public static Document[] getDocumentsByClient(String name, String orderBy) {
        Client c = clientList.get(name);
        
        if (c == null) {
            return null;
        }
        
        if (!orderBy.equals("Name") && !orderBy.equals("Date Added")) {
            orderBy = "Name";
        }
        
        HashMap<String, Document> dlist = c.getDocumentList();
        Document[] documents = dlist.values().toArray(new Document[0]);
        
        final String order = orderBy;
        
        // Custom comparator object to sort with
        Arrays.sort(documents, new Comparator(){
            @Override
            public int compare(Object a, Object b) {
                Document d1 = (Document)a;
                Document d2 = (Document)b;
                
                if (order.equals("Name")) {
                    return d1.getName().compareToIgnoreCase(d2.getName());
                } else {                    
                    String d1Date = d1.getDateAdded();
                    String d2Date = d2.getDateAdded();
                    
                    int year = d2Date.substring(8, 12).compareTo(d1Date.substring(8, 12));
                    
                    if (year != 0) {
                        return year;
                    } else {
                        d1Date.replace(d1Date.substring(0,3), dateMap.get(d1Date.substring(0,3)));
                        d2Date.replace(d2Date.substring(0,3), dateMap.get(d2Date.substring(0,3)));
                        
                        int month = d2Date.substring(0, 3).compareTo(d1Date.substring(0, 3));
                        
                        if (month != 0) {
                            return month;
                        } else {
                            int day = d2Date.substring(4, 6).compareTo(d1Date.substring(4, 6));
                            
                            if (day != 0) {
                                return day;
                            }
                        }
                    }
                    
                    int res = d1Date.compareTo(d2Date);
                    if (res == 0) {
                        return d1.getName().compareToIgnoreCase(d2.getName());
                    } else {
                        return res;
                    }
                }
            }
        });
        
        return documents;
    }