public void When_Regenerate_Then_should_call_correct_methods()
        {

            // Given
            var target = CreateService();
            var request = new ResendEmployeeChecklistEmailRequest()
                              {
                                  ResendUserId = Guid.NewGuid(),
                                  RiskAssessmentId = 500,
                                  EmployeeChecklistId = Guid.NewGuid()
                              };


            var user = new UserForAuditing();
            _userRepository
                .Setup(x => x.GetById(request.ResendUserId))
                .Returns(user);

            var employeeChecklistEmail = new EmployeeChecklist()
                                             {
                                                 EmployeeChecklistEmails = new List<EmployeeChecklistEmail>()
                                                                               {
                                                                                   new EmployeeChecklistEmail()
                                                                               },
                                                 Employee = new Employee
                                                                {
                                                                    ContactDetails = new List<EmployeeContactDetail>
                                                                                         {
                                                                                             new EmployeeContactDetail
                                                                                                 {
                                                                                                     Email = "*****@*****.**"
                                                                                                 }
                                                                                         }
                                                                }
                                             };
            _employeeChecklistRepository
                .Setup(x => x.GetByIdAndRiskAssessmentId(request.EmployeeChecklistId, request.RiskAssessmentId))
                .Returns(employeeChecklistEmail);

            // When
            target.Regenerate(request);
            
            // Then
            _userRepository.VerifyAll();
            _employeeChecklistRepository.VerifyAll();
            _employeeChecklistEmailRepository.Verify(x => x.Save(It.IsAny<EmployeeChecklistEmail>()), Times.Once());
            _employeeChecklistEmailRepository.Verify(x => x.Flush(), Times.Once());
        }
        public EmployeeChecklistEmail Regenerate(ResendEmployeeChecklistEmailRequest request)
        {
            _log.Add(request);

            try
            {
                var generatingUser = _userForAuditingRepository.GetById(request.ResendUserId);
                var employeeChecklist = _employeeChecklistRepository.GetByIdAndRiskAssessmentId(request.EmployeeChecklistId, request.RiskAssessmentId);
                var regenerateEmployeeChecklistEmail = EmployeeChecklistEmail.Generate(employeeChecklist, generatingUser);
                _employeeChecklistEmailRepository.Save(regenerateEmployeeChecklistEmail);
                _employeeChecklistEmailRepository.Flush();

                return regenerateEmployeeChecklistEmail;

            }
            catch (Exception e)
            {
                _log.Add(e);
                throw;
            }
        }