public ActionResult translate(FormCollection collection)
        {
            // Get the current domain
            Domain currentDomain = Tools.GetCurrentDomain();
            ViewBag.CurrentDomain = currentDomain;

            // Get query parameters
            string returnUrl = collection["returnUrl"];
            ViewBag.QueryParams = new QueryParams(returnUrl);

            // Check if the administrator is authorized
            if (Administrator.IsAuthorized(new string[] { "Administrator", "Editor", "Translator" }) == true)
            {
                ViewBag.AdminSession = true;
            }
            else if (Administrator.IsAuthorized(Administrator.GetAllAdminRoles()) == true)
            {
                ViewBag.AdminSession = true;
                ViewBag.AdminErrorCode = 1;
                ViewBag.TranslatedTexts = StaticText.GetAll(currentDomain.back_end_language, "id", "ASC");
                return View("index");
            }
            else
            {
                // Redirect the user to the start page
                return RedirectToAction("index", "admin_login");
            }

            // Get the admin default language
            Int32 adminLanguageId = currentDomain.back_end_language;

            // Get translated texts
            KeyStringList tt = StaticText.GetAll(adminLanguageId, "id", "ASC");

            // Get all the form values
            Int32 translationLanguageId = Convert.ToInt32(collection["selectLanguage"]);
            Int32 id = Convert.ToInt32(collection["hiddenWeblinkId"]);
            string link_name = collection["txtTranslatedLinkname"];
            string url = collection["txtTranslatedUrl"];
            bool inactive = Convert.ToBoolean(collection["cbInactive"]);

            // Create the translated weblink
            Weblink translatedWeblink = new Weblink();
            translatedWeblink.id = id;
            translatedWeblink.link_name = link_name;
            translatedWeblink.url = url;
            translatedWeblink.inactive = inactive;

            // Create a error message
            string errorMessage = string.Empty;

            // Check for errors
            if (translatedWeblink.link_name.Length > 100)
            {
                errorMessage += "&#149; " + String.Format(tt.Get("error_field_length"), tt.Get("link_name"), "100") + "<br/>";
            }
            if (translatedWeblink.url.Length > 100)
            {
                errorMessage += "&#149; " + String.Format(tt.Get("error_field_length"), tt.Get("url"), "100") + "<br/>";
            }

            // Check if there is errors
            if (errorMessage == string.Empty)
            {
                // Get the saved weblink
                Weblink weblink = Weblink.GetOneById(id, translationLanguageId);

                if (weblink == null)
                {
                    // Add a new translated weblink
                    Weblink.AddLanguagePost(translatedWeblink, translationLanguageId);
                }
                else
                {
                    // Update values for the saved weblink
                    weblink.link_name = translatedWeblink.link_name;
                    weblink.url = translatedWeblink.url;
                    weblink.inactive = translatedWeblink.inactive;

                    // Update the weblink translation
                    Weblink.UpdateLanguagePost(weblink, translationLanguageId);
                }

                // Redirect the user to the list
                return Redirect(returnUrl);
            }
            else
            {
                // Set form values
                ViewBag.LanguageId = translationLanguageId;
                ViewBag.Languages = Language.GetAll(adminLanguageId, "name", "ASC");
                ViewBag.StandardWeblink = Weblink.GetOneById(id, adminLanguageId);
                ViewBag.TranslatedWeblink = translatedWeblink;
                ViewBag.ErrorMessage = errorMessage;
                ViewBag.TranslatedTexts = tt;
                ViewBag.ReturnUrl = returnUrl;

                // Return the translate view
                return View("translate");
            }

        } // End of the translate method
        public ActionResult edit(FormCollection collection)
        {
            // Get the current domain
            Domain currentDomain = Tools.GetCurrentDomain();
            ViewBag.CurrentDomain = currentDomain;

            // Get query parameters
            string returnUrl = collection["returnUrl"];
            ViewBag.QueryParams = new QueryParams(returnUrl);

            // Check if the administrator is authorized
            if (Administrator.IsAuthorized(new string[] { "Administrator", "Editor" }) == true)
            {
                ViewBag.AdminSession = true;
            }
            else if (Administrator.IsAuthorized(Administrator.GetAllAdminRoles()) == true)
            {
                ViewBag.AdminSession = true;
                ViewBag.AdminErrorCode = 1;
                ViewBag.TranslatedTexts = StaticText.GetAll(currentDomain.back_end_language, "id", "ASC");
                return View("index");
            }
            else
            {
                // Redirect the user to the start page
                return RedirectToAction("index", "admin_login");
            }

            // Get all the form values
            Int32 id = Convert.ToInt32(collection["txtId"]);
            string link_name = collection["txtLinkname"];
            string url = collection["txtUrl"];
            string rel = collection["selectRelation"];
            string target = collection["selectTarget"];
            bool inactive = Convert.ToBoolean(collection["cbInactive"]);

            // Get the default admin language id
            Int32 adminLanguageId = currentDomain.back_end_language;

            // Get translated texts
            KeyStringList tt = StaticText.GetAll(adminLanguageId, "id", "ASC");

            // Get the weblink
            Weblink weblink = Weblink.GetOneById(id, adminLanguageId);

            // Check if the weblink exists
            if (weblink == null)
            {
                // Create an empty weblink
                weblink = new Weblink();
            }

            // Update values
            weblink.rel = rel;
            weblink.target = target;
            weblink.link_name = link_name;
            weblink.url = url;
            weblink.inactive = inactive;

            // Create a error message
            string errorMessage = string.Empty;

            // Check for errors
            if (weblink.link_name.Length > 100)
            {
                errorMessage += "&#149; " + String.Format(tt.Get("error_field_length"), tt.Get("linkname"), "100") + "<br/>";
            }
            if (weblink.url.Length > 100)
            {
                errorMessage += "&#149; " + String.Format(tt.Get("error_field_length"), tt.Get("url"), "100") + "<br/>";
            }
            
            // Check if there is errors
            if (errorMessage == string.Empty)
            {
                // Check if we should add or update the weblink
                if (weblink.id == 0)
                {
                    // Add the weblink
                    Int64 insertId = Weblink.AddMasterPost(weblink);
                    weblink.id = Convert.ToInt32(insertId);
                    Weblink.AddLanguagePost(weblink, adminLanguageId);
                }
                else
                {
                    // Update the weblink
                    Weblink.UpdateMasterPost(weblink);
                    Weblink.UpdateLanguagePost(weblink, adminLanguageId);
                }

                // Redirect the user to the list
                return Redirect(returnUrl);
            }
            else
            {
                // Set form values
                ViewBag.ErrorMessage = errorMessage;
                ViewBag.Weblink = weblink;
                ViewBag.TranslatedTexts = tt;
                ViewBag.ReturnUrl = returnUrl;

                // Return the edit view
                return View("edit");
            }

        } // End of the edit method