public void AttachHazardsToRiskAssessment(AttachHazardsToRiskAssessmentRequest request)
        {
            var user = _userForAuditingRepository.GetByIdAndCompanyId(request.UserId, request.CompanyId);
            var riskAssessment = _multiHazardRiskAssessmentRepository.GetByIdAndCompanyId(request.RiskAssessmentId, request.CompanyId);
            var hazards = _hazardsRepository.GetByIds(request.Hazards.Select(x=>x.Id).ToList());

            riskAssessment.AttachHazardsToRiskAssessment(hazards, user);


            request.Hazards.ForEach(hazardOrder =>
            {
                var orderNumber = hazardOrder.OrderNumber;
                var hazard = hazards.First(x => x.Id == hazardOrder.Id);
                riskAssessment.UpdateHazardOrder(hazard, orderNumber, user);
            });



            _multiHazardRiskAssessmentRepository.SaveOrUpdate(riskAssessment);
        }
        private void CreateRiskAssessmentWithFurtherControlMeasureTasksDocuments(int amountOfFurtherControlMeasureDocumentsToAdd)
        {
            var newRiskAssementId = CreateRiskAssessment();

            var sessionManager = ObjectFactory.GetInstance<IBusinessSafeSessionManager>();
            var riskAssessmentAttachmentService = ObjectFactory.GetInstance<IMultiHazardRiskAssessmentAttachmentService>();
            var attachHazardRequest = new AttachHazardsToRiskAssessmentRequest()
                                          {
                                              CompanyId = companyId,
                                              RiskAssessmentId = newRiskAssementId,
                                              UserId = GetRandomUserId(),
                                              Hazards = new List<AttachHazardsToRiskAssessmentHazardDetail>()
                                              {
                                                  new AttachHazardsToRiskAssessmentHazardDetail(){Id =GetRandomHazardId(), OrderNumber = 1},
                                              } 

                                          };
            riskAssessmentAttachmentService.AttachHazardsToRiskAssessment(attachHazardRequest);
            sessionManager.Session.Flush();


            var riskAssessmentFurtherActionService = ObjectFactory.GetInstance<IFurtherControlMeasureTaskService>();

            var documentsToAttach = new List<CreateDocumentRequest>();
            for (int i = 0; i < amountOfFurtherControlMeasureDocumentsToAdd; i++)
            {
                var randomId = new Random().Next(2500);
                string titleDescription = "Test " + randomId;
                documentsToAttach.Add(new CreateDocumentRequest()
                {
                    Title = titleDescription,
                    Description = titleDescription,
                    DocumentLibraryId = i,
                    Filename = "Test File Name" + randomId,
                    DocumentType = DocumentTypeEnum.GRADocumentType,
                    DocumentOriginType = DocumentOriginType.TaskCompleted,
                    Extension = ".doc",

                });
            }

            var riskAssessmentRepository = ObjectFactory.GetInstance<IGeneralRiskAssessmentRepository>();
            var riskAssessment = riskAssessmentRepository.GetById(newRiskAssementId);
            var riskAssessmentHazardId = riskAssessment.Hazards.First().Id;

            var request = new SaveFurtherControlMeasureTaskRequest()
            {
                CompanyId = companyId,
                RiskAssessmentId = newRiskAssementId,
                UserId = GetRandomUserId(),
                CreateDocumentRequests = documentsToAttach,
                Title = "",
                RiskAssessmentHazardId = riskAssessmentHazardId,
                FurtherControlMeasureTaskCategoryId = 3
            };
            riskAssessmentFurtherActionService.AddFurtherControlMeasureTask(request);
            sessionManager.Session.Flush();
        }