public ThreadPartHandler(IRepository<ThreadPartRecord> repository, IPostService postService, IThreadService threadService, IContentManager contentManager, ICountersService countersService, ISubscriptionService subscriptionService, IOrchardServices orchardServices ) { _postService = postService; _threadService = threadService; _contentManager = contentManager; _countersService = countersService; _subscriptionService = subscriptionService; _orchardServices = orchardServices; Filters.Add(StorageFilter.For(repository)); OnGetDisplayShape<ThreadPart>(SetModelProperties); OnGetEditorShape<ThreadPart>(SetModelProperties); OnUpdateEditorShape<ThreadPart>(SetModelProperties); OnActivated<ThreadPart>(PropertyHandlers); OnLoading<ThreadPart>((context, part) => LazyLoadHandlers(part)); OnCreated<ThreadPart>((context, part) => { _countersService.UpdateForumPartCounters(part); //bit expensive but doesn't happen frequently part.ForumsHomepageId = part.ForumPart.ForumCategoryPart.ForumsHomePagePart.Id; }); OnPublished<ThreadPart>((context, part) => { _countersService.UpdateForumPartCounters(part); part.LastestValidPostDate = DateTime.UtcNow; //bit expensive but doesn't happen frequently part.ForumsHomepageId = part.ForumPart.ForumCategoryPart.ForumsHomePagePart.Id; }); OnUnpublished<ThreadPart>((context, part) => _countersService.UpdateForumPartCounters(part)); OnVersioning<ThreadPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart)); OnVersioned<ThreadPart>((context, part, newVersionPart) => _countersService.UpdateForumPartCounters(newVersionPart)); OnRemoved<ThreadPart>((context, part) => OnThreadRemoved(context, part)); OnRemoved<ForumPart>((context, b) => _threadService.Delete(context.ContentItem.As<ForumPart>(), true)); }