public function setKey($key = null)
    {
        if (empty($key)) {

            $key = $this->get('private_key');

            if (empty($key)) {
                $key = gplcart_string_random();
                $this->set('private_key', $key);
            }

        } else {
            $this->set('private_key', $key);
        }

        return $this->key = $key;
    }