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

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

            var photoFromRepo = await _repo.GetPhoto(id);

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

            var currentMainPhoto = await _repo.GetMainPhoto(userId);

            currentMainPhoto.isMain = false;

            photoFromRepo.isMain = true;

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

            return(BadRequest("Could not set the main photo of the user."));
        }