var categoriesEntities = new List<CategoryEntity>();
var allCategories = GetCategories();
var postCategoryMappings = _postCategoryMapping.Where(m => m.PostID == postID).ToList();
postCategoryMappings.ForEach(mapping =>
{
var category = allCategories.Single(c => c.CategoryID == mapping.CategoryID);
var categoryEntity = new CategoryEntity { CategoryID = mapping.CategoryID, CategoryName = category.CategoryName, CategorySlug = category.CategorySlug };
categoriesEntities.Add(categoryEntity);
});