public override void FillObject(Type cardType, IFullTextSearchObject obj, IEntity entity)
        {
            if (cardType != null && typeof(IEmailMessageFullTextSearchObject) == cardType)
            {
                SecurityService.RunBySystemUser(delegate
                {
                    SecurityService.RunWithElevatedPrivilegies(delegate
                    {
                        var emailMessage = entity as IEmailMessage;
                        if (emailMessage != null)
                        {
                            var emailMessagesFullTextSearchObject = obj as IEmailMessageFullTextSearchObject;
                            if (emailMessagesFullTextSearchObject != null)
                            {
                                emailMessagesFullTextSearchObject.IndexedObject = emailMessage;
                                emailMessagesFullTextSearchObject.Id            = emailMessage.Id.ToString(CultureInfo.InvariantCulture);
                                emailMessagesFullTextSearchObject.Subject       = emailMessage.Subject;

                                emailMessagesFullTextSearchObject.Text = emailMessage.Text;


                                emailMessagesFullTextSearchObject.From =
                                    emailMessage.From.Select(c => c.EmailString).ToArray();
                                emailMessagesFullTextSearchObject.To =
                                    emailMessage.To.Select(c => c.EmailString).ToArray();
                                emailMessagesFullTextSearchObject.Owners =
                                    emailMessage.Owners.Select(c => c.EmailLogin).ToArray();
                                emailMessagesFullTextSearchObject.Contacts    = emailMessage.Contacts.Select(c => c.Id).ToArray();
                                emailMessagesFullTextSearchObject.Contractors = emailMessage.Contractors.Select(c => c.Id).ToArray();
                                emailMessagesFullTextSearchObject.DateUtc     = emailMessage.DateUtc;
                                emailMessagesFullTextSearchObject.TypeUid     = emailMessage.TypeUid.ToString("n");
                                emailMessagesFullTextSearchObject.IsDeleted   = emailMessage.IsDeleted;

                                /*  if (emailMessage.Permissions.Any())
                                 * {
                                 *    emailMessagesFullTextSearchObject.UserSecuritySetCacheId = (from p in (from a in emailMessage.Permissions
                                 *            where a.PermissionId == EleWise.ELMA.EmailMessages.PermissionProvider.EmailMessageViewPermission.Id
                                 *            select a).Distinct()
                                 *        select p.UserSecuritySetCacheId.ToString()).ToArray();
                                 * }
                                 */
                                ProcessingDynamicProperties(entity, emailMessagesFullTextSearchObject);
                            }
                        }
                    });
                });
            }
        }
 public override List <KeyValuePair <string, object> > CreateFromObject(Type cardType, IFullTextSearchObject obj)
 {
     if (cardType != null && typeof(IEmailMessageFullTextSearchObject) == cardType)
     {
         var emailMessagesFullTextSearchObject = obj as IEmailMessageFullTextSearchObject;
         if (emailMessagesFullTextSearchObject != null)
         {
             var list = WebData.CreateFromObject(obj).ToKeyValueList().ToList();
             return(list);
         }
     }
     return(new List <KeyValuePair <string, object> >());
 }