public Object processSaveState(FacesContext context) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (this.isTransient()) {
            return null;
        }
        Object[] stateStruct = new Object[2];
        Object[] childState = EMPTY_ARRAY;

        pushComponentToEL(context, null);

        try {
            // Process this component itself
            stateStruct[MY_STATE] = saveState(context);

            // determine if we have any children to store
            int count = this.getChildCount() + this.getFacetCount();
            if (count > 0) {

                // this arraylist will store state
                List<Object> stateList = new ArrayList<Object>(count);

                // if we have children, add them to the stateList
                if (this.getChildCount() > 0) {
                    Iterator kids = getChildren().iterator();
                    UIComponent kid;
                    while (kids.hasNext()) {
                        kid = (UIComponent) kids.next();
                        if (!kid.isTransient()) {
                            stateList.add(kid.processSaveState(context));
                        }
                    }
                }

                // if we have facets, add them to the stateList
                if (this.getFacetCount() > 0) {
                    Iterator myFacets = getFacets().entrySet().iterator();
                    UIComponent facet;
                    Object facetState;
                    Object[] facetSaveState;
                    Map.Entry entry;
                    while (myFacets.hasNext()) {
                        entry = (Map.Entry) myFacets.next();
                        facet = (UIComponent) entry.getValue();
                        if (!facet.isTransient()) {
                            facetState = facet.processSaveState(context);
                            facetSaveState = new Object[2];
                            facetSaveState[0] = entry.getKey();
                            facetSaveState[1] = facetState;
                            stateList.add(facetSaveState);
                        }
                    }
                }

                // finally, capture the stateList and replace the original,
                // EMPTY_OBJECT_ARRAY Object array
                childState = stateList.toArray();
            }
        } finally {
            popComponentFromEL(context);
        }

        stateStruct[CHILD_STATE] = childState;
        return stateStruct;
    }