//Get /api/Snippet/3
        public IHttpActionResult Get(int id)
        {
            SnippetService snippetService = CreateSnippetService();
            var            snippet        = snippetService.GetSnippetById(id);

            return(Ok(snippet));
        }
        private bool SetStarState(int snippetId, bool newState)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SnippetService(userId);

            var detail = service.GetSnippetById(snippetId);

            var updatedSnippet =
                new SnippetEdit
            {
                SnippetId = detail.SnippetId,
                IsStarred = newState,
                Phrase    = detail.Phrase,
                Language  = detail.Language,
                Meaning   = detail.Meaning,
            };

            return(service.EditSnippet(updatedSnippet));
        }