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

            var user = await _repo.GetUser(userId);

            if (!user.Photos.Any(p => p.Id == id))
            {
                return(Unauthorized("No matching photo"));
            }

            var photoFromRepo = await _repo.GetPhoto(id);

            if (photoFromRepo.IsMain)
            {
                return(BadRequest("Already main photo."));
            }

            var currentMainPhoto = await _repo.GetMainUserPhoto(userId);

            currentMainPhoto.IsMain = false;
            photoFromRepo.IsMain    = true;
            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

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