public async Task <IActionResult> SetMainListingPhoto(int listingId, int id)
        {
            var listingFromRepo = await _repo.GetListing(listingId);

            if (listingFromRepo.UserId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            if (!listingFromRepo.Photos.Any(p => p.Id == id))
            {
                return(Unauthorized());
            }

            var photoFromRepo = await _repo.GetListingPhoto(id);

            if (photoFromRepo.IsMain)
            {
                return(BadRequest("This is already the main photo"));
            }

            var currentMainPhoto = await _repo.GetMainListingPhoto(listingId);

            currentMainPhoto.IsMain = false;

            photoFromRepo.IsMain = true;

            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            return(BadRequest("Could not set photo to main"));
        }