/**
  * Main method to handle the user submitted word. Word is evaluated for correctness first.
  * After that it is added to the database and a proper message is displayed.
  * @return void
  */
 public function doSubmit()
 {
     $wordToBeAdded = $this->view->getWordToSubmit();
     if ($this->view->didUserPressSubmit()) {
         try {
             if ($this->checkWord($wordToBeAdded)) {
                 $this->wordList->add($wordToBeAdded);
                 $this->view->setMessageSuccess();
             }
         } catch (WordInvalidCharException $wie) {
             $this->view->setMessageInvalidInput();
         } catch (WordSizeException $wse) {
             $this->view->setMessageInvalidSize();
         } catch (WordExistsException $wee) {
             $this->view->setMessageDublicate();
         }
     }
 }
 public function setMessageDublicate()
 {
     self::$messageField = "Word already exists in database.";
 }