public CommsDeliveryService(
     ILogger logger,
     IValidator<DataContracts.Notification> notificationValidator,
     INotificationMapper notificationMapper,
     DomainObjects.ICommsDeliveryManager commsDeliveryManager)
 {
     _logger = logger;
     _notificationValidator = notificationValidator;
     _notificationMapper = notificationMapper;
     _commsDeliveryManager = commsDeliveryManager;
 }
        public Notification MapFrom(DomainObjects.Notification source)
        {
            var destination =
                new Notification
                {
                    DateAdded = _dateTimeResolver.UtcNow,
                    Payload = _payloadXmlSerializer.Serialize(source.Payload),
                    Type = source.Payload.GetPayloadType().ToString()
                };

            var providerName = source.Payload.GetProvider();
            if (!string.IsNullOrEmpty(providerName))
            {
                var provider =
                    new Provider
                    {
                        Name = providerName
                    };

                destination.AssignProvider(provider);
            }

            if (source.Details != null)
            {
                foreach (var metadata in source.Details)
                {
                    var details =
                        new NotificationDetail
                        {
                            Uri = string.Format("{0}:{1}", metadata.Key, metadata.Value)
                        };

                    destination.AddDetail(details);
                }
            }

            var recipients = source.Payload.GetRecipients().ToList();
            foreach (var r in recipients)
            {
                var recipient = new Recipient
                {
                    Token = r,
                    Status = Status.Pending
                };

                destination.AddRecipient(recipient);
            }

            return destination;
        }
 public DataContracts.Notification MapToDataContract(DomainObjects.Notification source)
 {
     return Mapper.Map<DomainObjects.Notification, DataContracts.Notification>(source);
 }