I have many to many relationship in entity framework. See image…

I want to insert an article and tags for this article, but TagName property is unique in db and so I need only new tags to be inserted in Tags and in ArticlesToTags(not seen in EF) tables while others that are already in Tags need to be inserted only in ArticlesToTags.
public void CreateUpdate(string title, string subTitle, string text,
string author, string tags, string photo, bool allowComments)
{
using (var context = new blogEntities())
{
var article = new Article()
{
Title = title,
SubTitle = subTitle,
ArticleText = text,
Author = author,
Photo = photo,
CreateDate = DateTime.Now,
ModifyDate = null,
AllowComments = allowComments
};
foreach (var tg in tags.Split(','))
{
article.Tags.Add(new Tag() { TagName = tg });
}
context.Articles.AddObject(article);
context.SaveChanges();
}
}
Now it throws exception of duplicate unique key cannot be inserted How is it done in EF? I’m new to it…
Add a select statement to see if there is already a tag in the database.