public async Task <IActionResult> Create([Bind("Id,Title,Content,VideoLink")] Post post, IEnumerable <int> SelectedCategories, string NewCategories) { if (ModelState.IsValid) { post.Writer = await getWriterAsync(); twitterController.publishTweet(post.Writer.DisplayName + " just posted a new quack titled " + post.Title); List <Category> categories = PrepareCategories(SelectedCategories, NewCategories); foreach (var category in categories) { _context.Add(new PostCategory { Post = post, Category = category }); } _context.Add(post); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(post)); }