private function getStatusIndex($statusname)
    {
        $status_count = count($this->states);
        for ($i = 0; $i < $status_count; ++$i) {
            if ($this->states[$i]->getName() == $statusname) {
                return $i;
            }
        }
    }