public ActivityStreamContentDescription GetContentDescription(ActiviyStreamWriterContext context)
        {
            if (!this.CanApply(context))
            {
                return(null);
            }

            var ticketPart = context.ContentItem.As <TicketPart>();

            RouteValueDictionary routeValueDictionary = new RouteValueDictionary();

            routeValueDictionary.Add("action", "Display");
            routeValueDictionary.Add("controller", "Ticket");
            routeValueDictionary.Add("area", "Orchard.CRM.Core");
            routeValueDictionary.Add("id", context.ContentItem.Id);
            ActivityStreamContentDescription returnValue = new ActivityStreamContentDescription(StreamWriters.TicketStreamWriter)
            {
                Weight = 1, RouteValues = routeValueDictionary
            };

            // new ticket
            if (context.Snapshot == null)
            {
                returnValue.Description = this.GetCreatedTicketDescription(ticketPart);
                return(returnValue);
            }

            string ticketDescription = this.GetTicketIdAndTitle(ticketPart.Record);

            returnValue.Description = string.Format("{0} {1}", this.T("Changed Ticket").Text, ticketDescription);
            return(returnValue);
        }
        public ActivityStreamContentDescription GetContentDescription(ActiviyStreamWriterContext context)
        {
            if (!this.CanApply(context))
            {
                return(null);
            }

            // TODO: find a better way
            var changes = this.GetChangesDescriptions(context);

            if (changes != null && changes.Count() <= 1)
            {
                return(null);
            }

            string contentItemDescription = this.contentItemDescriptorManager.GetDescription(context.ContentItem);
            ActivityStreamContentDescription activityStreamContentDescription = new ActivityStreamContentDescription(StreamWriters.ContentItemPermissionStreamWriter);

            // weight of this description is low, it measn if there are changes of another writer like Ticket, the description of the ticket will be used
            activityStreamContentDescription.Weight      = -20;
            activityStreamContentDescription.Description = T("Change permissions of '{0}'", contentItemDescription).Text;
            return(activityStreamContentDescription);
        }