public async Task AddSolution(Solution solution) { var entity = _mapper.Map <Data.Models.Solution>(solution); await _solutionRepository.Add(entity); foreach (var testResult in solution.TestResults) { testResult.SolutionId = entity.Id; } await _testResultService.AddTestResults(solution.TestResults); }