private async Task <WhatsappResponse> ProcessSystemMessage(UserCommand userCommand, UserInfo userInfo,
                                                                   WhatsappMessage whatsappMessage)
        {
            string responseMessage;

            object[] pars     = { userInfo.Name };
            bool     accepted = false;

            switch (userCommand)
            {
            case UserCommand.LeaveBox:
                userInfo.ConversationState = ConversationState.AwaitingActivation;
                userInfo.BoxInfo           = null;
                pars = new object[] { userInfo.Name };
                await _userStore.UpdateUser(userInfo);

                _logger.LogWarning("The user {phoneNumber} got discoupled from the box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                responseMessage = "We hebben u ontkoppeld van de box, {0}";
                accepted        = true;
                break;

            case UserCommand.ViewBox:
                _logger.LogWarning("The user {phoneNumber} asked a view link for the box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                if (!string.IsNullOrEmpty(userInfo.BoxInfo?.BoxId))
                {
                    pars            = new object[] { $"https://coditfamilyview.azurewebsites.net?boxId={userInfo.BoxInfo.BoxId}" };
                    responseMessage = "U kan hier de box zien: {0}";
                    accepted        = true;
                }
                else
                {
                    pars            = new object[] { userInfo.Name };
                    responseMessage = "U bent nog niet gekoppeld aan een box, {0}";
                }
                break;

            default:
                responseMessage =
                    $"Het spijt ons, maar we hebben nog geen ondersteuning voor het commando {whatsappMessage.MessageContent}";
                break;
            }

            return(new WhatsappResponse
            {
                ResponseMessage = (await _messageTranslater.Translate(userInfo.GetLanguage(), responseMessage, pars)),
                Accepted = accepted
            });
        }
        private async Task <WhatsappResponse> ProcessSystemMessage(UserCommand userCommand, UserInfo userInfo,
                                                                   WhatsappMessage whatsappMessage)
        {
            string responseMessage;

            object[] pars     = { userInfo.Name };
            bool     accepted = false;

            switch (userCommand)
            {
            case UserCommand.Statistics:
                _logger.LogWarning("The user {phoneNumber} asked for statitics of box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                if (!String.IsNullOrEmpty(userInfo.BoxInfo?.BoxId))
                {
                    var box = await _boxStore.Get(userInfo.BoxInfo.BoxId);

                    if (box.AdminUserPhone == userInfo.PhoneNumber)
                    {
                        var lastConnectedDateTime = await _boxStore.GetLastConnectedDateTime(userInfo.BoxInfo.BoxId);

                        pars = new object[] {
                            userInfo.Name,
                            box.Status,
                            lastConnectedDateTime.ToString("d MMM yyyy HH:mm:ss"),
                            _userStore.GetUsersFromTenant(userInfo.BoxInfo.BoxId).Result.Count(),
                            _messageServiceProvider.GetItems(userInfo.BoxInfo.BoxId).Result.Count(),
                            _imageServiceProvider.GetItems(userInfo.BoxInfo.BoxId).Result.Count()
                        };
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.AppendLine("{0}, dit zijn de statistics van uw box:");
                        stringBuilder.AppendLine("Box status: {1}");
                        stringBuilder.AppendLine("Laatst geraadpleegde datum: {2}");
                        stringBuilder.AppendLine("Aantal gekoppelde gebruikers: {3}");
                        stringBuilder.AppendLine("Aantal berichten: {4}");
                        stringBuilder.AppendLine("Aantal afbeeldingen: {5}");

                        responseMessage = stringBuilder.ToString();
                    }
                    else
                    {
                        pars            = new object[] { userInfo.Name };
                        responseMessage = "Alleen de Admin van de box kan statistics opvragen {0}.";
                    }
                }
                else
                {
                    pars            = new object[] { userInfo.Name };
                    responseMessage = "U bent nog niet gekoppeld aan een box, {0}";
                }

                break;

            case UserCommand.BoxStatus:
                _logger.LogWarning("The user {phoneNumber} asked for status of box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                if (!String.IsNullOrEmpty(userInfo.BoxInfo?.BoxId))
                {
                    var lastConnectedDateTime = await _boxStore.GetLastConnectedDateTime(userInfo.BoxInfo.BoxId);

                    pars            = new object[] { userInfo.Name, lastConnectedDateTime.ToString("d MMM yyyy HH:mm:ss") };
                    responseMessage = "De box is voor het laatst geraadpleegd op {1}, {0}.";
                }
                else
                {
                    pars            = new object[] { userInfo.Name };
                    responseMessage = "U bent nog niet gekoppeld aan een box, {0}";
                }
                break;

            case UserCommand.ClearMedia:
                _logger.LogWarning("The user {phoneNumber} asked for clearing all media of box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                if (!String.IsNullOrEmpty(userInfo.BoxInfo?.BoxId))
                {
                    var box = await _boxStore.Get(userInfo.BoxInfo.BoxId);

                    if (box.AdminUserPhone == userInfo.PhoneNumber)
                    {
                        await _messageServiceProvider.DeleteContent(userInfo);

                        await _imageServiceProvider.DeleteContent(userInfo);

                        pars            = new object[] { userInfo.Name };
                        responseMessage = "Alle content van de box is verwijderd {0}.";
                    }
                    else
                    {
                        pars            = new object[] { userInfo.Name };
                        responseMessage = "Alleen de Admin van de box kan alle content verwijderen {0}.";
                    }
                }
                else
                {
                    pars            = new object[] { userInfo.Name };
                    responseMessage = "U bent nog niet gekoppeld aan een box, {0}";
                }
                break;

            case UserCommand.LeaveBox:
                userInfo.ConversationState = ConversationState.AwaitingActivation;
                userInfo.BoxInfo           = null;
                pars = new object[] { userInfo.Name };
                await _userStore.UpdateUser(userInfo);

                _logger.LogWarning("The user {phoneNumber} got discoupled from the box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                responseMessage = "We hebben u ontkoppeld van de box, {0}";
                accepted        = true;
                break;

            case UserCommand.ViewBox:
                _logger.LogWarning("The user {phoneNumber} asked a view link for the box {boxId}",
                                   userInfo.PhoneNumber, userInfo.BoxInfo?.BoxId);
                if (!string.IsNullOrEmpty(userInfo.BoxInfo?.BoxId))
                {
                    pars            = new object[] { $"https://coditfamilyview.azurewebsites.net?boxId={userInfo.BoxInfo.BoxId}" };
                    responseMessage = "U kan hier de box zien: {0}";
                    accepted        = true;
                }
                else
                {
                    pars            = new object[] { userInfo.Name };
                    responseMessage = "U bent nog niet gekoppeld aan een box, {0}";
                }
                break;

            default:
                responseMessage =
                    $"Het spijt ons, maar we hebben nog geen ondersteuning voor het commando {whatsappMessage.MessageContent}";
                break;
            }

            return(new WhatsappResponse
            {
                ResponseMessage = (await _messageTranslater.Translate(userInfo.GetLanguage(), responseMessage, pars)),
                Accepted = accepted
            });
        }