public SummaryDto CreateForUser(Int32 userId, CreateSummaryDto summaryData) { User user = _userRepository.Get(userId); if (user.Type != UserType.Candidate) { throw new ArgumentException($"Unable to create summary for not candidate user with id {userId}!"); } if (_summaryRepository.IsHaveForUser(userId)) { throw new ArgumentException($"Summary for user with id {userId} have already created!"); } var summary = new Summary( user, _specializationRepository.GetByName(summaryData.Specialization), summaryData.Skills .Select(s => _skillRepository.GetByName(s)) .ToList(), summaryData.Information); summary = _summaryRepository.Create(summary); return(SummaryDto.Create(summary)); }