public void OnContentDeleted(object sender, ContentEventArgs e)
{
var contentRef = e.ContentLink.ToReferenceWithoutVersion();
var categoryRepo = ServiceLocator.Current.GetInstance<ICategoryRepository>();
// We'll delete in both directions, so this method is valid for both categories and assigned content
categoryRepo.DeleteAssignmentsByCategory(contentRef);
categoryRepo.DeleteAssignmentsByContent(contentRef);
}