public void AddAssignment(ContentReference contentRef, ContentReference categoryRef, string scope)
{
contentRef = contentRef.ToReferenceWithoutVersion();
categoryRef = categoryRef.ToReferenceWithoutVersion();
var matchingAssignments = Store.Items<CategoryAssignment>().Where(ca => ca.ContentPage == contentRef && ca.CategoryPage == categoryRef && ca.Scope == scope);
if(matchingAssignments.Count() > 0)
{
return;
}
var categoryAssignment = new CategoryAssignment()
{
ContentPage = contentRef,
CategoryPage = categoryRef,
Scope = scope
};
Store.Save(categoryAssignment);
}