public void CreateEmployeeProfile(string userId, int age, string aboutMe, int[] skillsId) { var user = _userManager.FindById(userId); if (user == null) { throw new ObjectNotFoundException($"User with id={userId} not found"); } if (user.EmployeeProfile != null) { throw new ArgumentException($"Employee profile with id={userId} already exists", "EmployeeProfile"); } var employeeProfile = new EmployeeProfile() { User = user, Age = age, AboutMe = aboutMe }; foreach (var skillId in skillsId) { Skill skill = _skillRepository.FindById(skillId); if (skill == null) { throw new ObjectNotFoundException($"Skill with id={skillId} not found"); } employeeProfile.Skills.Add(skill); } _employeeRepository.Create(employeeProfile); }