private static void PopulatePermission(Permissions permissions,
                                               ITracingService trace, FieldService fieldService)
        {
            trace.Trace("Contact populate permission - start");
            if (permissions == null)
            {
                return;
            }
            if (fieldService == null)
            {
                return;
            }

            fieldService.PopulateField(Attributes.Contact.SendMarketingByPost,
                                       CommonXrm.GetMarketingByPost(permissions.DoNotAllowMail));
            fieldService.PopulateField(Attributes.Contact.MarketingByPhone,
                                       CommonXrm.GetMarketingByPhone(permissions.DoNotAllowPhoneCalls));
            fieldService.PopulateField(Attributes.Contact.SendMarketingBySms,
                                       CommonXrm.GetMarketingBySms(permissions.DoNotAllowSms));
            fieldService.PopulateField(Attributes.Contact.SendMarketingByEmail,
                                       CommonXrm.GetMarketingByEmail(permissions.DoNotAllowEmail));
            fieldService.PopulateField(Attributes.Contact.ThomasCookMarketingConsent,
                                       CommonXrm.GetMarketingConsent(permissions.AllowMarketing));
            trace.Trace("Contact populate permission - end");
        }
 private static void PopulatePermission(Entity contact, Permissions permissions, ITracingService trace)
 {
     if (permissions == null)
     {
         return;
     }
     trace.Trace("Contact populate permission - start");
     contact[Attributes.Contact.SendMarketingByPost]        = CommonXrm.GetMarketingByPost(permissions.DoNotAllowMail);
     contact[Attributes.Contact.MarketingByPhone]           = CommonXrm.GetMarketingByPhone(permissions.DoNotAllowPhoneCalls);
     contact[Attributes.Contact.SendMarketingBySms]         = CommonXrm.GetMarketingBySms(permissions.DoNotAllowSms);
     contact[Attributes.Contact.SendMarketingByEmail]       = CommonXrm.GetMarketingByEmail(permissions.DoNotAllowMail);
     contact[Attributes.Contact.ThomasCookMarketingConsent] = CommonXrm.GetMarketingConsent(permissions.AllowMarketing);
     trace.Trace("Contact populate permission - end");
 }