public JsonResult Post([FromBody]List<AppConfigurationMapperAttributes> configMapperValues, string hash = null)
#endif
        {
            if (configMapperValues == null) return null;

            var res = new AppConfigurationServerResponse();

            var config = Environment.GetEnvironmentVariables();

            foreach (var configMapperValue in configMapperValues)
            {
                if (configMapperValue.ValueIsRequired && !config.Contains(configMapperValue.Name))
                {
                    if (res.AppConfigErors == null) res.AppConfigErors = new List<AppConfigurationError>();
                    var appConfigError = new AppConfigurationError
                    {
                        Content = Constants.AppConfigurationKeyNotFoundError,
                        Mapping = configMapperValue
                    };
                    res.AppConfigErors.Add(appConfigError);
                }
                else
                {
                    var appConfigValue = new AppConfigurationValue()
                    {
                        Value = config[configMapperValue.Name] as string,
                        Attributes = configMapperValue
                    };
                    res.AppConfigValues.Add(appConfigValue);
                }
            }

            //MK don't return app configuration values if an error occured
            if (res.HasErrors) res.AppConfigValues = null;

#if NETStandard16
            return res;
#elif NET452
            return new JsonResult()
            {
                Data = res
            };
#endif
        }
        private async Task HandleRetrievedAppConfigFailure(AppConfigurationServerResponse appConfigurationServerResponse)
        {
#if DEBUG
            //Display all errors
            var responseErrors = appConfigurationServerResponse.AppConfigErors;
            foreach (var responseError in responseErrors)
            {
                await UserDialogService.AlertAsync($"Message: {responseError.Content}");
            }
#else
            //Display user-friendly alert
            var alertAsync = UserDialogService?.AlertAsync($"Something went wrong we couldn't retrieve your app configuration");
            if (alertAsync != null) await alertAsync;
#endif
        }
        private AppConfiguration CreateAppConfigurationOutOfServerResponse(AppConfigurationServerResponse appConfigurationServerResponse)
        {
            AppConfiguration res = null;
            if ((appConfigurationServerResponse?.HasErrors ?? true) || !appConfigurationServerResponse.HasConfigValues) return res;

            res = new AppConfiguration();
            foreach (var value in appConfigurationServerResponse.AppConfigValues)
            {
                if (string.IsNullOrEmpty(value?.Attributes?.Name)) continue;

                res[value.Attributes.Name] = value;
            }

            return res;
        }