public async Task <IActionResult> RegisterSchool([FromBody] School schoolToCreate)
        {
            if (await _repo.SchoolExists(schoolToCreate.Name))
            {
                return(BadRequest("School already exists"));
            }

            var createdSchool = await _repo.CreateSchool(schoolToCreate);

            if (await _repo.SaveAll())
            {
                return(Ok(createdSchool.Id));
            }

            throw new Exception($"Creating school {schoolToCreate.Name} failed on save");
        }
        public SchoolDTO CreateSchool(SchoolDTO schoolDTO)
        {
            var newSchool = new School()
            {
                Id   = schoolDTO.Id,
                Name = schoolDTO.Name
            };

            var result = _schoolRepository.CreateSchool(newSchool);

            var newSchoolDTO = new SchoolDTO()
            {
                Id   = result.Id,
                Name = result.Name
            };

            return(newSchoolDTO);
        }