public void VerifyOrganizationAndProjectStatistics()
        {
            Error error = ErrorData.GenerateError(id: TestConstants.ErrorId, projectId: TestConstants.ProjectId, organizationId: TestConstants.OrganizationId, nestingLevel: 5, minimiumNestingLevel: 1);

            var organization = _organizationRepository.GetById(TestConstants.OrganizationId);

            Assert.Equal(1, organization.ProjectCount);
            Assert.Equal(0, organization.StackCount);
            Assert.Equal(0, organization.ErrorCount);
            Assert.Equal(0, organization.TotalErrorCount);

            var project = _projectRepository.GetById(TestConstants.ProjectId);

            Assert.Equal(0, project.StackCount);
            Assert.Equal(0, project.ErrorCount);
            Assert.Equal(0, project.TotalErrorCount);

            var       pipeline  = IoC.GetInstance <ErrorPipeline>();
            Exception exception = Record.Exception(() => pipeline.Run(error));

            Assert.Null(exception);

            organization = _organizationRepository.GetById(TestConstants.OrganizationId);
            Assert.Equal(1, organization.StackCount);
            Assert.Equal(1, organization.ErrorCount);
            Assert.Equal(1, organization.TotalErrorCount);

            project = _projectRepository.GetById(TestConstants.ProjectId);
            Assert.Equal(1, project.StackCount);
            Assert.Equal(1, project.ErrorCount);
            Assert.Equal(1, project.TotalErrorCount);

            exception = Record.Exception(() => pipeline.Run(error));
            Assert.Null(exception);
            organization = _organizationRepository.GetById(TestConstants.OrganizationId);
            Assert.Equal(1, organization.StackCount);
            Assert.Equal(1, organization.ErrorCount);
            Assert.Equal(1, organization.TotalErrorCount);

            project = _projectRepository.GetById(TestConstants.ProjectId);
            Assert.Equal(1, project.StackCount);
            Assert.Equal(1, project.ErrorCount);
            Assert.Equal(1, project.TotalErrorCount);

            error.Id  = TestConstants.ErrorId2;
            exception = Record.Exception(() => pipeline.Run(error));
            Assert.Null(exception);

            organization = _organizationRepository.GetById(TestConstants.OrganizationId);
            Assert.Equal(1, organization.StackCount);
            Assert.Equal(2, organization.ErrorCount);
            Assert.Equal(2, organization.TotalErrorCount);

            project = _projectRepository.GetById(TestConstants.ProjectId);
            Assert.Equal(1, project.StackCount);
            Assert.Equal(2, project.ErrorCount);
            Assert.Equal(2, project.TotalErrorCount);

            exception = Record.Exception(() => pipeline.Run(ErrorData.GenerateSampleError(TestConstants.ErrorId8)));
            Assert.Null(exception);

            organization = _organizationRepository.GetById(TestConstants.OrganizationId);
            Assert.Equal(2, organization.StackCount);
            Assert.Equal(3, organization.ErrorCount);
            Assert.Equal(3, organization.TotalErrorCount);

            project = _projectRepository.GetById(TestConstants.ProjectId);
            Assert.Equal(2, project.StackCount);
            Assert.Equal(3, project.ErrorCount);
            Assert.Equal(3, project.TotalErrorCount);

            Repository.RemoveAllByErrorStackIdAsync(error.ErrorStackId).Wait();
            organization = _organizationRepository.GetById(TestConstants.OrganizationId);
            Assert.Equal(2, organization.StackCount);
            Assert.Equal(1, organization.ErrorCount);
            Assert.Equal(3, organization.TotalErrorCount);

            project = _projectRepository.GetById(TestConstants.ProjectId);
            Assert.Equal(2, project.StackCount);
            Assert.Equal(1, project.ErrorCount);
            Assert.Equal(3, project.TotalErrorCount);
        }