private static async Task UpdateQuestionSet(Dfc.DiscoverSkillsAndCareers.Models.QuestionSet questionSet, ILogger log)
        {
            try
            {
                var entity = await DbContext.QuestionSets.FirstOrDefaultAsync(x => x.Id == questionSet.QuestionSetVersion);

                if (entity == null)
                {
                    entity = new Data.Entities.UmQuestionSet {
                        Id = questionSet.QuestionSetVersion
                    };
                    UpdateQuestionSetEntityFromDto(entity, questionSet);
                    DbContext.QuestionSets.Add(entity);
                }
                else
                {
                    UpdateQuestionSetEntityFromDto(entity, questionSet);
                    DbContext.QuestionSets.Update(entity);
                }

                int changes = await DbContext.SaveChanges();

                log.LogTrace($"Changes updated {changes}");
            }
            catch (Exception ex)
            {
                log.LogError(ex, $"Failed to update question set");
                throw;
            }
        }
 private static void UpdateQuestionSetEntityFromDto(Data.Entities.UmQuestionSet entity, Dfc.DiscoverSkillsAndCareers.Models.QuestionSet dto)
 {
     entity.AssessmentType = dto.AssessmentType;
     entity.Id             = dto.QuestionSetVersion;
     entity.MaxQuestions   = dto.MaxQuestions;
     entity.Title          = dto.Title;
     entity.Version        = dto.Version;
     entity.LastUpdatedDt  = dto.LastUpdated;
 }