public async Task <IActionResult> Post([FromBody] Star star)
        {
            _spaceRepository.AddStar(star);
            bool result = await _spaceRepository.SaveChangesAsync();

            return(Created($"api/stars/{star.Id}", star));
        }
        public async Task <IActionResult> Post([FromBody] Star star)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest("Star is missing required data"));
                }
                _spaceRepository.AddStar(star);
                bool result = await _spaceRepository.SaveChangesAsync();

                if (result)
                {
                    return(Created($"api/planets/{star.Id}", star));
                }
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Could not reach the database"));
            }
            return(BadRequest());
        }