public IActionResult DeleteBlogPost(int id)
        {
            if (!_blogInfoRepository.PostExists(id))
            {
                return(NotFound());
            }

            var blogPostEntity = _blogInfoRepository.GetPost(id);

            if (blogPostEntity == null)
            {
                return(NotFound());
            }

            _blogInfoRepository.DeleteBlogPost(blogPostEntity);

            if (!_blogInfoRepository.Save())
            {
                return(StatusCode(500, "A problem happened while handling your request."));
            }

            _logger.LogInformation(
                $"Blog Post {blogPostEntity.Title} with id {blogPostEntity.Id} was deleted.");

            return(NoContent());
        }