public async Task Handle(CarePlanCreated message)
        {
            var obj = this.ParseMessage(message);

            var nhsNumber = obj.Subject.Identifier.Value;
            var patient   = await this.Patients.GetOne(nhsNumber);

            if (patient == null)
            {
                return;
            }

            var activity = obj.Activity.Select(x =>
                                               $"{((CodeableConcept)x.Detail.Product).Coding[0].Display} ({((CodeableConcept)x.Detail.Product).Coding[0].Code}) - {x.Detail.Status}")
                           .ToArray();

            var clinicalNote = new ClinicalNote
            {
                ClinicalNotesType = "Care Plan",
                Notes             = $"{obj.Title}. {obj.Period.Start} to {obj.Period.End}. {string.Join(", ", activity)}",
                PatientId         = nhsNumber,
                Author            = obj.Author[0].Display,
                DateCreated       = obj.Meta?.LastUpdated?.DateTime ?? DateTime.UtcNow,
                Source            = "INR",
                SourceId          = obj.Identifier[0].Value
            };

            await this.ClinicalNotes.AddOrUpdate(clinicalNote);
        }
        public async Task Handle(CarePlanCreated message)
        {
            var obj = this.ParseMessage(message);

            var activity = obj.Activity.Select(x =>
                                               $"{((CodeableConcept)x.Detail.Product).Coding[0].Display} ({((CodeableConcept)x.Detail.Product).Coding[0].Code}) - {x.Detail.Status}")
                           .ToArray();

            var notification = new Notification
            {
                Ods         = message.Destination,
                System      = message.System,
                NhsNumber   = obj.Subject.Identifier.Value,
                DateCreated = DateTime.UtcNow,
                Type        = obj.TypeName,
                Summary     = $"{obj.Title}. {obj.Period.Start} to {obj.Period.End}.",
                Details     = $"{string.Join(", ", activity)}",
                Json        = this.ToString()
            };

            await this.Notifications.AddOrUpdate(notification);

            await this.Hub.Clients.Group(message.Destination?.ToLowerInvariant()).SendAsync("notification", notification);
        }