/// <summary>
        /// Returns the display names of the given encounter.
        /// </summary>
        private async Task <IEnumerable <LocalString> > GetDisplayNames(LocationAreaEncounter encounter)
        {
            var locationArea = await LocationAreasService.Upsert(encounter.LocationArea);

            var locationAreaNames = locationArea.DisplayNames;

            var location = await LocationsService.Upsert(locationArea.Location.Id);

            var locationNames = location.DisplayNames;

            // only provide names in locales that have name data for both location and location area
            var availableLocales = locationNames.Select(n => n.Language)
                                   .Intersect(locationAreaNames.Select(n => n.Language));

            var displayNames = availableLocales.Select(l =>
            {
                var name = locationNames.Single(n => n.Language == l).Value;

                var locationAreaName = locationAreaNames.Single(n => n.Language == l).Value;
                if (!string.IsNullOrEmpty(locationAreaName))
                {
                    name += $" ({locationAreaName})";
                }

                return(new LocalString
                {
                    Language = l,
                    Value = name
                });
            });

            return(displayNames);
        }
        /// <summary>
        /// Returns whether the given encounter is present in the given version group.
        /// </summary>
        private bool IsInVersionGroup(LocationAreaEncounter encounter, VersionGroupEntry versionGroup)
        {
            var versions          = versionGroup.Versions.Select(v => v.Name);
            var encounterVersions = encounter.VersionDetails.Select(vd => vd.Version.Name);

            return(versions.Intersect(encounterVersions).Any());
        }