public function getData($unique = false)
    {
        $data = array();

        foreach ($this->_data as $name => $state) {
            if (isset($state->value)) {
                //Only return unique data
                if ($unique) {
                    //Unique values cannot be null or an empty string
                    if ($state->unique && $this->_validate($state)) {
                        $result = true;

                        //Check related states to see if they are set
                        foreach ($state->required as $required) {
                            if (!$this->_validate($this->_data[$required])) {
                                $result = false;
                                break;
                            }
                        }

                        //Prepare the data to be returned. Include states
                        if ($result) {
                            $data[$name] = $state->value;

                            foreach ($state->required as $required) {
                                $data[$required] = $this->_data[$required]->value;
                            }
                        }
                    }
                } else {
                    $data[$name] = $state->value;
                }
            }
        }

        return $data;
    }