public async Task TestEventsVariousUsers()
        {
            TelemetryUnitOfWork unit = new TelemetryUnitOfWork(this.TelemetryContext, this.PortalContext, new AssemblyStreamVersionReader());
            List <KeyValuePair <string, Guid> > apps = await Helpers.SeedInitialPrograms(this.PortalContext, this.TelemetryContext, 2, "TestApp", new[] { "Billy Jean", "Jack Black" });

            Helpers.GetProgramAndUser(unit, "TestApp", "Billy Jean", out TelemetryRootObject prg, out ClientAppUser usr);

            TelemetryItem telemetryItem = new TelemetryItem()

            {
                EntryKey          = Helpers.GetName("Func1"),
                TelemetryItemType = TelemetryItemTypes.Event,
                Sequence          = "aaa:1",
                VersionData       = new VersionData("1.2.3.4", "2.0.0.0"),
                Timestamp         = new DateTimeOffset(DateTime.UtcNow),
                Properties        = new Dictionary <string, string> {
                    { "AKey", "AValue" }, { "AKey2", "AValue2" }
                },
                UserIdentifier = usr.UserIdentifier
            };

            List <TelemetrySummary> result = await TelemetryControllerHelpers.InsertData(unit, (new[] { telemetryItem }).ToList(), prg, "127.1.1.1");

            Event @event = prg.Events.Single();

            Guid eventId = this.TelemetryContext.Events.FirstOrDefault(x => x.Name == @event.Name).Id;

            Helpers.AssertUpdateResponse(result, prg, usr, 1, Helpers.GetName("Func1"), eventId);

            Assert.AreEqual(1, prg.Events.Count);
            Assert.AreEqual(Helpers.GetName("Func1"), @event.Name);
            Assert.AreEqual(1, @event.TelemetrySummaries.Count);
            Assert.AreEqual(prg.ProgramId, @event.ProgramId);

            TelemetrySummary summary = @event.GetTelemetrySummary(this.GetUserByGuid(result.First().ClientAppUser.Id).Id);

            Assert.AreEqual(usr.Id, summary.ClientAppUserId);

            TelemetryDetail detail = @event.GetTelemetryDetails(this.GetUserByGuid(result.First().ClientAppUser.Id).Id).Single();

            Assert.AreEqual(detail.GetTelemetrySummary().Id, summary.Id);
            Assert.AreEqual(usr.Id, detail.GetTelemetrySummary().ClientAppUserId);
            Assert.AreEqual(usr.UserIdentifier, detail.UserIdentifier);
            Assert.AreEqual(2, detail.GetTelemetryUnits().Count());
            Assert.AreEqual("AKey", detail.GetTelemetryUnits().ElementAt(0).Key);
            Assert.AreEqual("AValue", detail.GetTelemetryUnits().ElementAt(0).ValueString);
            Assert.AreEqual("AKey2", detail.GetTelemetryUnits().ElementAt(1).Key);
            Assert.AreEqual("AValue2", detail.GetTelemetryUnits().ElementAt(1).ValueString);


            ClientAppUser otherUser = Helpers.GetUser(unit, "Jack Black");

            telemetryItem = new TelemetryItem()

            {
                EntryKey          = Helpers.GetName("Func1"),
                TelemetryItemType = TelemetryItemTypes.Event,
                Sequence          = "aaa:1",
                VersionData       = new VersionData("1.2.3.4", "2.0.0.0"),
                Timestamp         = new DateTimeOffset(DateTime.UtcNow),
                Properties        = new Dictionary <string, string> {
                    { "AKey3", "AValue3" }, { "AKey4", "AValue4" }, { "AKey5", "AValue5" }
                },
                UserIdentifier = otherUser.UserIdentifier
            };

            result = await TelemetryControllerHelpers.InsertData(unit, (new[] { telemetryItem }).ToList(), prg, "127.1.1.1");

            Helpers.AssertUpdateResponse(result, prg, otherUser, 1, Helpers.GetName("Func1"), eventId);

            prg = await unit.GetMonitoredProgram(prg.TelemetryKey);

            Assert.AreEqual(1, prg.Events.Count);
            @event = prg.Events.Single();
            Assert.AreEqual(Helpers.GetName("Func1"), @event.Name);
            Assert.AreEqual(2, @event.TelemetrySummaries.Count);
            Assert.AreEqual(1, @event.GetTelemetrySummary(this.GetUserByGuid(result.First().ClientAppUser.Id).Id).SummaryCount);
            Assert.AreEqual(1, summary.GetTelemetryDetails().Count());

            Assert.AreNotEqual(otherUser.Id, usr.Id);

            TelemetrySummary otherSummary = @event.GetTelemetrySummary(this.GetUserByGuid(result.First().ClientAppUser.Id).Id);

            Assert.AreEqual(otherUser.Id, otherSummary.ClientAppUserId);

            TelemetryDetail otherUserDetail = @event.GetTelemetryDetails(this.GetUserByGuid(result.First().ClientAppUser.Id).Id).Single();

            Assert.AreEqual(otherUser.Id, otherUserDetail.GetTelemetrySummary().ClientAppUserId);
            Assert.AreEqual(otherUser.UserIdentifier, otherUserDetail.UserIdentifier);
            Assert.AreEqual(3, otherUserDetail.GetTelemetryUnits().Count());
            Assert.AreEqual("AKey3", otherUserDetail.GetTelemetryUnits().ElementAt(0).Key);
            Assert.AreEqual("AValue3", otherUserDetail.GetTelemetryUnits().ElementAt(0).ValueString);
            Assert.AreEqual("AKey5", otherUserDetail.GetTelemetryUnits().ElementAt(2).Key);
            Assert.AreEqual("AValue5", otherUserDetail.GetTelemetryUnits().ElementAt(2).ValueString);

            telemetryItem = new TelemetryItem()

            {
                EntryKey          = Helpers.GetName("Func1"),
                TelemetryItemType = TelemetryItemTypes.Event,
                Sequence          = "aaa:1",
                VersionData       = new VersionData("1.2.3.4", "2.0.0.0"),
                Timestamp         = new DateTimeOffset(DateTime.UtcNow),
                Properties        = new Dictionary <string, string> {
                    { "AKey", "AValue" }, { "AKey2", "AValue2" }
                },
                UserIdentifier = usr.UserIdentifier
            };

            //run again with first user
            result = await TelemetryControllerHelpers.InsertData(unit, (new[] { telemetryItem }).ToList(), prg, "127.1.1.1");

            @event = prg.Events.Single();
            Assert.AreEqual(2, @event.TelemetrySummaries.Count);
            Assert.AreEqual(2, @event.GetTelemetrySummary(this.GetUserByGuid(result.First().ClientAppUser.Id).Id).SummaryCount);
            Assert.AreEqual(2, summary.GetTelemetryDetails().Count());


            List <EventTelemetryDetail> details = @event.GetTelemetryDetails(this.GetUserByGuid(result.First().ClientAppUser.Id).Id).OrderBy(x => x.Timestamp)
                                                  .Cast <EventTelemetryDetail>().ToList();

            Assert.AreEqual(2, details.Count);
            Assert.IsTrue(details.All(x => x.TelemetrySummary.ClientAppUserId == this.GetUserByGuid(result.First().ClientAppUser.Id).Id));
            Assert.IsTrue(details.First().Timestamp < details.Last().Timestamp);

            Assert.AreEqual(3, this.TelemetryContext.EventTelemetryDetails.Count(x => x.TelemetrySummary.Event.Name == telemetryItem.EntryKey));
            Assert.AreEqual(2, this.TelemetryContext.EventTelemetryDetails.Count(x => x.TelemetrySummaryId == summary.Id));
        }