private void AddBlogTag(IBlogPostCommand command, BlogPost post) { if (command.BlogTags == null) { return; } foreach (var item in command.BlogTags.Where(c => c.Name != null)) { var tag = new BlogTag { Name = item.Name, CreationDate = DateTime.Now, Creator = "sdf", }; if (item.IsNew) { post.AddTag(tag); // post.BlogTags.ForEach(c => c.BlogTags.Add(tag)); } else { var productTag = _blogRepository.GetBlogTagByValue(item.Name); post.BlogTags.Add(productTag); } } }