public async Task <ResponseViewModel> AddSnippet([FromBody] AddSnippetViewModel addSnippetViewModel) { var user = JsonConvert.DeserializeObject <User>(_tokenCreator.DecodeToken(addSnippetViewModel.Token)); if (user == null) { return(_responseCreator.CreateFailure("Bad user token!")); } var tags = await _tagService.AddOrUpdateTags(addSnippetViewModel.Tags); var language = _languageService.GetLanguageByContent(addSnippetViewModel.Language); if (language == null) { return(_responseCreator.CreateFailure("Bad language!")); } var snippet = await _snippetService.AddSnippet(addSnippetViewModel.Name, addSnippetViewModel.Description, addSnippetViewModel.Code, user, language, tags); return(_responseCreator.CreateSuccess("Snippet added successfully")); }