public async Task <IActionResult> SetShareIsAccepted([FromBody] SetShareIsAcceptedDto dto)
        {
            if (dto == null)
            {
                return(BadRequest());
            }

            int userId;

            try
            {
                userId = IdentityHelper.GetUserId(User);
            }
            catch (UnauthorizedAccessException)
            {
                return(Unauthorized());
            }

            await _listService.SetShareIsAcceptedAsync(dto.ListId, userId, dto.IsAccepted);

            // Notify
            var usersToBeNotified = await _userService.GetToBeNotifiedOfListChangeAsync(dto.ListId, userId);

            if (usersToBeNotified.Any())
            {
                var currentUser = await _userService.GetAsync(userId);

                SimpleList list = await _listService.GetAsync(dto.ListId);

                var localizerKey = dto.IsAccepted ? "JoinedListNotification" : "DeclinedShareRequestNotification";

                foreach (var user in usersToBeNotified)
                {
                    CultureInfo.CurrentCulture = new CultureInfo(user.Language, false);
                    var message = _localizer[localizerKey, IdentityHelper.GetUserName(User), list.Name];

                    var createNotificationDto = new CreateOrUpdateNotification(user.Id, userId, list.Id, null, message);
                    var notificationId        = await _notificationService.CreateOrUpdateAsync(createNotificationDto);

                    var pushNotification = new PushNotification
                    {
                        SenderImageUri = currentUser.ImageUri,
                        UserId         = user.Id,
                        Application    = "To Do Assistant",
                        Message        = message,
                        OpenUrl        = GetNotificationsPageUrl(notificationId)
                    };

                    _senderService.Enqueue(pushNotification);
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> SetShareIsAccepted([FromBody] SetShareIsAcceptedDto dto)
        {
            if (dto == null)
            {
                return(BadRequest());
            }

            int userId;

            try
            {
                userId = IdentityHelper.GetUserId(User);
            }
            catch (UnauthorizedAccessException)
            {
                return(Unauthorized());
            }

            await _recipeService.SetShareIsAcceptedAsync(dto.RecipeId, userId, dto.IsAccepted);

            // Notify
            var usersToBeNotified = await _userService.GetToBeNotifiedOfRecipeChangeAsync(dto.RecipeId, userId);

            if (usersToBeNotified.Any())
            {
                var currentUser = await _userService.GetAsync(userId);

                RecipeToNotify recipe = await _recipeService.GetAsync(dto.RecipeId);

                var localizerKey = dto.IsAccepted ? "JoinedRecipeNotification" : "DeclinedShareRequestNotification";

                foreach (var user in usersToBeNotified)
                {
                    CultureInfo.CurrentCulture = new CultureInfo(user.Language, false);
                    var message = _localizer[localizerKey, IdentityHelper.GetUserName(User), recipe.Name];

                    var pushNotification = new PushNotification
                    {
                        SenderImageUri = currentUser.ImageUri,
                        UserId         = user.Id,
                        Application    = "Cooking Assistant",
                        Message        = message
                    };

                    _senderService.Enqueue(pushNotification);
                }
            }

            return(NoContent());
        }