//[System.Web.Http.HttpPost]
        public HttpResponseMessage Post([FromBody] VocabularyWord model)
        {
            if (UserID == null)
            {
                return(ResponseError(HttpStatusCode.Forbidden, "Log in required."));
            }
            Sql sql = new Sql("WHERE OwnerID=@0", UserID);

            int listID = 0;



            if (model.list != null && int.TryParse(model.list, out listID))
            {
                sql.Append("AND ID=@0", listID);
            }

            sql.Append("ORDER BY ID DESC");

            VocabularyList vc = VocabularyList.FirstOrDefault(sql);



            if (vc == null)
            {
                return(ResponseError(HttpStatusCode.PreconditionFailed, "No vocabulary list found."));
            }

            try
            {
                SuomenkieliRepository.AddVocabularyWord(model.word, vc.ID, UserID);
            }
            catch (Exception ex)
            {
                return(ResponseError(HttpStatusCode.InternalServerError, ex.Message));
            }


            int wordID = SuomenkieliRepository.GetWordID(model.word).GetValueOrDefault(); // This should not be null.

            FullWord fWord = SuomenkieliRepository.GetFullWord(wordID);

            string firstDef = (fWord.Definitions.Count > 0) ? fWord.Definitions.First()._Definition : "";

            ResponseWord rWord = new ResponseWord()
            {
                id = fWord.ID, word = fWord._Word, definition = firstDef
            };

            var resp = Request.CreateResponse <ResponseWord>(HttpStatusCode.OK, rWord);

            return(resp);

            //return ResponseOK(rWord);
        }
        public HttpResponseMessage Delete([FromBody] VocabularyWord model)
        {
            if (UserID == null)
            {
                return(ResponseError(HttpStatusCode.Forbidden, "Log in required."));
            }
            Sql sql = new Sql("WHERE OwnerID=@0", UserID);

            int listID = 0;


            if (model.list != null && int.TryParse(model.list, out listID))
            {
                sql.Append("AND ID=@0", listID);
            }

            sql.Append("ORDER BY ID DESC");

            VocabularyList vc = VocabularyList.FirstOrDefault(sql);



            if (vc == null)
            {
                return(ResponseError(HttpStatusCode.PreconditionFailed, "No vocabulary list found."));
            }

            try
            {
                SuomenkieliRepository.RemoveVocabularyWord(model.word, vc.ID, UserID);
            }
            catch (Exception ex)
            {
                return(ResponseError(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(ResponseOK(model.word));
        }