public async Task <ActionResult <Student> > CreateStudent(Student student) { if (await _educationService.CodeExists(student.UniqueCode)) { ModelState.AddModelError("UniqueCode", $"Unique code '{student.UniqueCode}' already in use"); return(Conflict(ModelState)); } var created = await _educationService.CreateStudent(student); return(CreatedAtAction(nameof(GetStudent), new { created.Id }, created)); }