public ActionResult ImportContacts(long id)
        {
            User userObj = (User)Session["user"];
            Account accountObj = (Account)Session["account"];

            var folderName = CCFolderRepository.CCFolders.FirstOrDefault(fid => fid.FolderID == id & fid.AccountGUID == accountObj.AccountGUID).Name;
            ViewBag.foldername = folderName;

            if (Request.Files.Count > 0)
            {
                var file = Request.Files[0];

                if (file != null && file.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
                    string fileExtension = System.IO.Path.GetExtension(path);

                    if (fileExtension == ".xls" || fileExtension == ".xlsx")
                    {
                        ViewBag.MessageExtention = "";

                        file.SaveAs(path);

                        ItemsImporter importcontact = new ItemsImporter(CCFieldRepository, CCFieldValueRepository, CCItemRepository);

                        LimitationsViewModel limitationsObj = (LimitationsViewModel)Session["limitations"];

                        long maxItemImportCount = limitationsObj.maxItemCountPerFolder - limitationsObj.folderList.Where(f => f.fold.FolderID == id).FirstOrDefault().itemCount;

                        long numberOfContacts = importcontact.ImportInputContacts(id, accountObj.AccountGUID, path, fileExtension, maxItemImportCount);

                        if (System.IO.File.Exists(path))
                        {
                            System.IO.File.Delete(path);
                        }

                        if (numberOfContacts == -2)
                        {
                            ViewBag.MessageItemImportExceed = "The number of contacts to be imported exceeds the Max Item per Folder Count";
                            //ViewBag.Message = "";
                            //ViewBag.MessagePass = "";
                        }
                        else if (numberOfContacts > 0)
                        {
                            ViewBag.MessagePass = "******" + (numberOfContacts - 1) + " contacts were imported.";
                            //ViewBag.Message = "";
                            //ViewBag.MessageItemImportExceed = "";
                        }
                        else
                        {
                            ViewBag.Message = "No matching fields were found in the imported file. O contacts imported.";
                            //ViewBag.MessagePass = "";
                            //ViewBag.MessageItemImportExceed = "";
                        }

                    }

                    else
                    {
                        ViewBag.MessageExtention = "Please select the .xls or .xlsx file";
                        //ViewBag.MessagePass = "";
                        //ViewBag.MessageItemImportExceed = "";
                        //ViewBag.Message = "";
                    }

                }
            }

            LimitationsViewModel limitationsObjMain = (LimitationsViewModel)Session["limitations"];
            HelperFunctions HF = new HelperFunctions();
            limitationsObjMain = HF.updateAccountLimitations(accountObj);
            Session["limitations"] = limitationsObjMain;

            return View(id);
            //  return RedirectToAction("ImportContacts");
        }
        public ActionResult AddContact(AddContactViewModel objContact)
        {
            Account accountObj = (Account)Session["account"];
            string timeZone = (string)Session["timeZone"];
            int type = 1;
            ItemsImporter importcontact = new ItemsImporter(CCFieldRepository, CCFieldValueRepository, CCItemRepository);
            CCFolder folderDetails = null;
            folderDetails = CCFolderRepository.FolderDetails(objContact.FolderID);
            if (folderDetails != null) { type = folderDetails.Type; }
            else { type = 1; }
            bool res = importcontact.ImportSingleContact(objContact, type, accountObj.AccountGUID, timeZone);

            LimitationsViewModel limitationsObj = (LimitationsViewModel)Session["limitations"];
            HelperFunctions HF = new HelperFunctions();
            limitationsObj = HF.updateAccountLimitations(accountObj);
            Session["limitations"] = limitationsObj;

            if (res) return RedirectToAction("Items", "Folder", new { id = objContact.FolderID });
            else { return RedirectToAction("AddContact", "Folder", new { id = objContact.FolderID, state = 1 }); }
        }