public void CreateStore(string storeName, string street, string zip, string city, string countryCode, string stateCode, double latitude, double longitude, int mapZoomLevel, string urlName, string phone, string imageTitle)
        {
            // Set the provider name for the DynamicModuleManager here. All available providers are listed in
            // Administration -> Settings -> Advanced -> DynamicModules -> Providers
            var providerName = String.Empty;

            // Set the culture name for the multilingual fields
            var cultureName = "en";

            Thread.CurrentThread.CurrentUICulture = new CultureInfo(cultureName);

            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
            Type           shopType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Stores.Store");
            DynamicContent shopItem = dynamicModuleManager.CreateDataItem(shopType);

            // This is how values for the properties are set
            shopItem.SetString("Title", storeName, cultureName);

            LibrariesManager libraryManager = LibrariesManager.GetManager();
            var image = libraryManager.GetImages().FirstOrDefault(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Title == imageTitle);

            if (image != null)
            {
                shopItem.AddImage("StoreImage", image.Id);
            }

            Telerik.Sitefinity.GeoLocations.Model.Address myAddress = new Telerik.Sitefinity.GeoLocations.Model.Address();
            myAddress.City         = city;
            myAddress.CountryCode  = countryCode;
            myAddress.StateCode    = stateCode;
            myAddress.MapZoomLevel = mapZoomLevel;
            myAddress.Latitude     = latitude;
            myAddress.Longitude    = longitude;
            myAddress.Street       = street;
            myAddress.Zip          = zip;

            shopItem.SetValue("Address", myAddress);

            shopItem.SetString("UrlName", urlName, cultureName);
            shopItem.SetString("Phone", phone, cultureName);
            shopItem.SetValue("Owner", SecurityManager.GetCurrentUserId());
            shopItem.SetValue("PublicationDate", DateTime.Now);

            ILifecycleDataItem publishedFrontendContentItem = dynamicModuleManager.Lifecycle.Publish(shopItem);

            shopItem.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Published");

            dynamicModuleManager.SaveChanges();
        }
        public void CreateStore(string storeName, string street, string zip, string city, string countryCode, string stateCode, double latitude, double longitude, int mapZoomLevel, string urlName, string phone, string imageTitle)
        {
            // Set the provider name for the DynamicModuleManager here. All available providers are listed in
            // Administration -> Settings -> Advanced -> DynamicModules -> Providers
            var providerName = String.Empty;

            // Set the culture name for the multilingual fields
            var cultureName = "en";
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(cultureName);

            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
            Type shopType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Stores.Store");
            DynamicContent shopItem = dynamicModuleManager.CreateDataItem(shopType);

            // This is how values for the properties are set
            shopItem.SetString("Title", storeName, cultureName);
            
            LibrariesManager libraryManager = LibrariesManager.GetManager();
            var image = libraryManager.GetImages().FirstOrDefault(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Title == imageTitle);
            if (image != null)
            {
                shopItem.AddImage("StoreImage", image.Id);
            }

            Telerik.Sitefinity.GeoLocations.Model.Address myAddress = new Telerik.Sitefinity.GeoLocations.Model.Address();
            myAddress.City = city;
            myAddress.CountryCode = countryCode;
            myAddress.StateCode = stateCode;
            myAddress.MapZoomLevel = mapZoomLevel;
            myAddress.Latitude = latitude;
            myAddress.Longitude = longitude;
            myAddress.Street = street;
            myAddress.Zip = zip;

            shopItem.SetValue("Address", myAddress);

            shopItem.SetString("UrlName", urlName, cultureName);
            shopItem.SetString("Phone", phone, cultureName);
            shopItem.SetValue("Owner", SecurityManager.GetCurrentUserId());
            shopItem.SetValue("PublicationDate", DateTime.Now);

            ILifecycleDataItem publishedFrontendContentItem = dynamicModuleManager.Lifecycle.Publish(shopItem);
            shopItem.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Published");

            dynamicModuleManager.SaveChanges();
        }