Checking if there are tags or categories in the database The code below is used to check if there are tags or categories in the database. If they exist, they are not added to the database, otherwise they are added.

Is this code efficient and easy to read?

private void CreateTagCategoryBlog(string Tags, string category)
    {
        int lastInsertedId = postRepo.GetAll().LastOrDefault().BlogPostId;
        var allTags = tagRepo.GetAll().Where(e =&gt; e.Name.Contains(Tags)).ToList().DefaultIfEmpty();
        var allCategories = catRepo.GetAll().Where(e =&gt; e.Name.Contains(category)).ToList().DefaultIfEmpty();

        foreach (var x in GetItems&lt;Tag&gt;(Tags, tagRepo))
        {
            blogTag.Add(new BlogTag
            {
                TagId = x.TagID,
                BlogPostId = lastInsertedId,
                DateAdded = DateTime.Now,
                LastModifiedDate = DateTime.Now,
                IsDeleted = false
            });
        }

        foreach (var x in GetItems&lt;Category&gt;(category, catRepo))
        {
            blogCat.Add(new BlogCategory
            {
                BlogPostId = lastInsertedId,
                CategoryId = x.CategoryId,
                DateAdded = DateTime.Now,
                LastModifiedDate = DateTime.Now,
                IsDeleted = false
            });
        }
    }
Parameters should be camelCased, so Tags should be tags. As far as I can tell though only one tag is passed in, so it should be the singular tag. 
x isn't a very good variable name. It looks like you used it as a generic name because you were copy/pasting. The two loops are slightly different, but not by a whole lot. Consider how you could possibly pass the string and repository into a method instead.