public ActionResult Confirmation(string id)
        {
            CheckConnection();
            Unconfirmed_Users user = _db.Unconfirmed_Users.Where(x => x.ConfirmationCode == id).FirstOrDefault();

            _db.Users.Add(new User()
            {
                UserName = user.Username,
                Email = user.Email,
                Password = user.Password,
                Secret = Random32(),
                isFbUser = false,
                Lang=user.Lang,
                CreateDate=DateTime.Now,
            });
            _db.SaveChanges();

            _db.Unconfirmed_Users.RemoveRange(_db.Unconfirmed_Users.Where(x => x.Email == user.Email));
            _db.SaveChanges();

            return View();
        }
        public JsonResult Registration(Registration model)
        {
            CheckConnection();

            var lang = CultureInfo.CurrentCulture.Name;
            var langName = CultureInfo.CurrentCulture.EnglishName;

            if (!model.IsFbUser)
            {
                int UserName_count = _db.Users.Where(x => x.UserName == model.UserName).Count();
                var email = _db.Users.Where(x => x.isFbUser == false).ToList();
                int Email_count = email.Where(x => x.Email == model.Email.ToLower()).Count();

                if (string.IsNullOrWhiteSpace(model.UserName) || string.IsNullOrWhiteSpace(model.Email) || string.IsNullOrWhiteSpace(model.Password) || string.IsNullOrWhiteSpace(model.ConfirmPassword))
                {
                    return Json(1, JsonRequestBehavior.AllowGet);
                }
                else if (model.Password.Length < 6)
                {
                    return Json(2, JsonRequestBehavior.AllowGet);
                }
                else if (model.Password != model.ConfirmPassword)
                {
                    return Json(3, JsonRequestBehavior.AllowGet);
                }
                else if (!EmailValidator.IsValidEmail(model.Email))
                {
                    return Json(4, JsonRequestBehavior.AllowGet);
                }
                else if (Email_count > 0)
                {
                    return Json(5, JsonRequestBehavior.AllowGet);
                }
                else if (UserName_count > 0)
                {
                    return Json(6, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    checkLanguage();
                    string conf = Random32();
                    MD5Helper MD5 = new MD5Helper();
                    Unconfirmed_Users un_user = new Unconfirmed_Users()
                    {
                        Username = model.UserName,
                        Email = model.Email.ToLower(),
                        Password = MD5.ToMD5(model.Password + secret),
                        ConfirmationCode = conf,
                        Lang=lang,
                        CreteDate = DateTime.Now
                    };
                    _db.Unconfirmed_Users.Add(un_user);
                    _db.SaveChanges();

                    string body = "გასააქტიურებლად გთხოვთ გადახვიდეთ <a href='http://localhost:2080/Account/Confirmation/" + conf + "'target='_blank' >ბმულზე</a>";
                    MailSender.SendMail(model.Email, "confirmation", body, true);

                }

                return Json(0, JsonRequestBehavior.AllowGet);
            }
            else
            {
                var Fb_email = _db.Users.Where(x => x.isFbUser == true).ToList();
                int Fb_Email_count = Fb_email.Where(x => x.Email == model.Email.ToLower()).Count();
                if (Fb_Email_count > 0)
                {
                    Session["User"] = model.UserName;
                    return Json("", JsonRequestBehavior.AllowGet);
                }
                else
                {
                    checkLanguage();
                    _db.Users.Add(new User()
                    {
                        Email = model.Email,
                        UserName = model.UserName,
                        isFbUser = true,
                        Lang=lang,
                        CreateDate=DateTime.Now
                    });
                    _db.SaveChanges();
                    Session["User"] = model.UserName;
                    return Json("", JsonRequestBehavior.AllowGet);
                }
            }
        }