public function withErrors($validator)
    {
        foreach ($validator->errors() as $key => $value) {
            if (count($value) > 1) {
                for ($i = 0; $i < count($value); $i++) {
                    $data[$key][$i] = $value[$i];
                }
            } else {
                $data[$key] = $value[0];
            }
            $this->_errors->add((object) $data);
        }

        $this->_session->flash('errors', $this->_errors->all());

        return $this;
    }