private void SendNotification(CalendarEventWithAdditionalData message, IPushNotification notificationConfiguration)
        {
            var templateExpressionContext = new Dictionary <string, string>
            {
                ["employee"]  = message.Owner.Name,
                ["startDate"] = message.Event.Dates.StartDate.ToString("dd/MM/yyyy")
            };

            templateExpressionContext = new DictionaryMerge().Perform(
                templateExpressionContext,
                message.Event.AdditionalData.ToDictionary(x => x.Key, x => x.Value));

            var content = new PushNotificationContent
            {
                Title      = notificationConfiguration.Title,
                Body       = new TemplateExpressionParser().Parse(notificationConfiguration.Body, templateExpressionContext),
                CustomData = new
                {
                    message.Event.EventId,
                    message.Owner.EmployeeId,
                    ManagerId = message.Manager.EmployeeId,
                    Type      = message.NotificationType == NotificationType.Created
                        ? CalendarEventPushNotificationTypes.SickLeaveCreatedManager
                        : message.NotificationType == NotificationType.Prolonged
                            ? CalendarEventPushNotificationTypes.SickLeaveProlongedManager
                            : CalendarEventPushNotificationTypes.SickLeaveCancelledManager
                }
            };

            Context.System.EventStream.Publish(new NotificationEventBusMessage(
                                                   new PushNotification(content, message.ManagerPushTokens)));
        }
        private void SendNotification(CalendarEventWithAdditionalData message, IEmailNotification notificationConfiguration)
        {
            var templateExpressionContext = new Dictionary <string, string>
            {
                ["employee"]   = message.Owner.Name,
                ["employeeId"] = message.Owner.EmployeeId,
                ["startDate"]  = message.Event.Dates.StartDate.ToString("dd/MM/yyyy"),
                ["endDate"]    = message.Event.Dates.EndDate.ToString("dd/MM/yyyy")
            };

            templateExpressionContext = new DictionaryMerge().Perform(
                templateExpressionContext,
                message.Event.AdditionalData.ToDictionary(x => x.Key, x => x.Value));

            var templateExpressionParser = new TemplateExpressionParser();

            var sender    = notificationConfiguration.NotificationSender;
            var recipient = message.Manager?.Email;
            var subject   = templateExpressionParser.Parse(notificationConfiguration.Subject, templateExpressionContext);
            var body      = templateExpressionParser.Parse(notificationConfiguration.Body, templateExpressionContext);

            Context.System.EventStream.Publish(
                new NotificationEventBusMessage(
                    new EmailNotification(sender, new[] { recipient }, subject, body)));
        }