solves issue U4-2356 when deleting templates

yeah, you need to update cmsDocument based on the templateId