private static string serializeModule(Module.Module module)
        {
            XmlSerializer serializer = new XmlSerializer(module.GetType());

            using (StringWriter sw = new StringWriter())
            {
                serializer.Serialize(sw, module);
                return(sw.ToString());
            }
        }
        public static void AddOrReplaceLocationData(string city, string postal, string cityCode, string country, string language, string state)
        {
            try
            {
                using (SQLiteConnection dbConn = new SQLiteConnection(new SQLitePlatformWinRT(), path))
                {
                    LocationTable newRow = new LocationTable
                    {
                        Id       = 0,
                        City     = city,
                        Postal   = postal,
                        CityCode = cityCode,
                        Country  = country,
                        Language = language,
                        State    = state
                    };

                    // ReSharper disable once AccessToDisposedClosure
                    dbConn.RunInTransaction(() => { dbConn.InsertOrReplace(newRow); });

                    TableQuery <ModuleTable> query = dbConn.Table <ModuleTable>();

                    foreach (ModuleTable moduleTable in query)
                    {
                        Module.Module module = (Module.Module)DeserializeModule(moduleTable.ModuleConfig);

                        module.City         = city;
                        module.Postal       = postal;
                        module.CityCode     = cityCode;
                        module.Country      = country;
                        module.Language     = language;
                        module.NewsCountry  = (Countries)Enum.Parse(typeof(Countries), country.ToUpper());
                        module.NewsLanguage = (Languages)Enum.Parse(typeof(Languages), language.ToUpper());

                        AddOrReplaceModule(moduleTable.ModuleName, module);
                    }
                }
            }
            catch (Exception exception)
            {
                Log.Log.WriteException(exception);
            }
        }
        private static string SerializeModule(Module.Module module)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(module.GetType());

                using (StringWriter sw = new StringWriter())
                {
                    serializer.Serialize(sw, module);
                    return(sw.ToString());
                }
            }
            catch (Exception exception)
            {
                Log.Log.WriteException(exception);

                return(string.Empty);
            }
        }
        public static void AddOrReplaceModule(Modules moduleName, Module.Module module)
        {
            try
            {
                using (SQLiteConnection dbConn = new SQLiteConnection(new SQLitePlatformWinRT(), path))
                {
                    ModuleTable newRow = new ModuleTable
                    {
                        ModuleName   = moduleName,
                        ModuleConfig = SerializeModule(module)
                    };

                    // ReSharper disable once AccessToDisposedClosure
                    dbConn.RunInTransaction(() => { dbConn.InsertOrReplace(newRow); });
                }
            }
            catch (Exception exception)
            {
                Log.Log.WriteException(exception);
            }
        }