public function submit($senderUserId, DTO\ClsAnswerDto $answer)
 {
     $check = $this->getTablObj()->isAnswerNew($answer);
     if ($check) {
         $result = $this->getTablObj()->update($answer);
     } else {
         $result = $this->getTablObj()->Insert($answer->userId, $answer->destId, $answer->optionId);
         if ($result) {
             $json = json_encode(new DTO\ClsAnswerDto($answer->userId, $answer->destId, $answer->optionId, $result, date('Y-m-d H:i:s')));
             $syncController = new \App\Controller\SyncController();
             $syncController->answerEntry($senderUserId, $answer->userId, $json, INSERT);
             \Cake\Log\Log::debug("Sync Entry for Answer");
         }
     }
     if ($result) {
         \Cake\Log\Log::debug('answer submited');
         $this->response->body(DTO\ClsErrorDto::prepareSuccessMessage("Answer Saved"));
         $this->response->send();
     } else {
         \Cake\Log\Log::error('answer not submited');
         $this->response->body(DTO\ClsErrorDto::prepareError(120));
         $this->response->send();
     }
 }
 private function updateLike($senderUserId, $count, DTO\ClsCommentAndLikeDto $likeDto)
 {
     $result = $this->getTableObj()->updateLike($count, $likeDto->userId, $likeDto->destId);
     if ($result) {
         $json = json_encode(new DTO\ClsLikeDto($likeDto->userId, $likeDto->destId, $result));
         $syncController = new \App\Controller\SyncController();
         $syncController->likeEntry($senderUserId, $likeDto->userId, $json, UPDATE);
         \Cake\Log\Log::debug('Like succefully stored');
         $this->response->body(DTO\ClsErrorDto::prepareSuccessMessage("Like Saved"));
         $this->response->send();
     } else {
         \Cake\Log\Log::error('Like not saved');
         $this->response->body(\App\DTO\ClsErrorDto::prepareError(109));
         $this->response->send();
     }
 }