CreateStudentForInstitute(Guid instituteId, StudentAddDto student) { if (!await _instituteRepository.InstituteExistsAsync(instituteId)) { return(NotFound()); } var entity = _mapper.Map <Student>(student); _instituteRepository.AddStudent(instituteId, entity); await _instituteRepository.SaveAsync(); var dtoToReturn = _mapper.Map <StudentDto>(entity); return(CreatedAtRoute(nameof(GetStudentForInstitute), new { instituteId, studentId = dtoToReturn.Id }, dtoToReturn)); }