public async Task <IActionResult> SetMainPhoto(int userId, int id)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var photoFromRepo = await _repo.GetPhoto(id);

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

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

            var currentMainPhoto = await _repo.GetMainPhotoForUserAsync(userId);

            if (currentMainPhoto != null)
            {
                currentMainPhoto.IsMain = false;
            }

            photoFromRepo.IsMain = true;

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

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