public async Task<ActionResult> CompleteAsync()
        {
            //preventing error if permission is denied
            string deniedToken = Request.QueryString["denied"];
            if (!string.IsNullOrEmpty(deniedToken))
            {
                return RedirectToAction("Login", "Account");
            }

            var auth = new LinqToTwitter.MvcAuthorizer
            {
                CredentialStore = new LinqToTwitter.SessionStateCredentialStore()
            };

            await auth.CompleteAuthorizeAsync(Request.Url);

            // This is how you access credentials after authorization.
            // The oauthToken and oauthTokenSecret do not expire.
            // You can use the userID to associate the credentials with the user.
            // You can save credentials any way you want - database, 
            //   isolated storage, etc. - it's up to you.
            // You can retrieve and load all 4 credentials on subsequent 
            //   queries to avoid the need to re-authorize.
            // When you've loaded all 4 credentials, LINQ to Twitter will let 
            //   you make queries without re-authorizing.
            //
            var credentials = auth.CredentialStore;
            string oauthToken = credentials.OAuthToken;
            string oauthTokenSecret = credentials.OAuthTokenSecret;
            string screenName = credentials.ScreenName;
            ulong userID = credentials.UserID;

            DateTime createdDate = DateTime.Now;
            var twitterCtx = new LinqToTwitter.TwitterContext(auth);
           
            //-- GET USER PROFILE DATA
            var userResponse =
                (from user in twitterCtx.User
                 where user.Type == LinqToTwitter.UserType.Lookup &&
                       user.UserIdList == userID.ToString()
                 select user)
                .ToList();

            var userData = userResponse.FirstOrDefault();


            string twitterUserID = userID.ToString();
            string twitterScreenName = credentials.ScreenName;
            string twitterProfilePic = string.Empty;
            string twitterProfileDesc = string.Empty;
            string twitterProfileName = string.Empty;
            string source = "Twitter";
            if (userData != null)
            {
                twitterProfileName = userData.Name;
                twitterProfilePic = userData.ProfileImageUrl;
                twitterProfileDesc = userData.Description;
            }

            int loginUserID = 1;
            string loginUserType = USERTYPE.User.ToString();

            UserSession.InitializeUserSession(loginUserID, loginUserType);
            // initialize FormsAuthentication
            FormsAuthentication.Initialize();
            // create a new ticket used for authentication                        
            FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, loginUserID.ToString(), DateTime.Now, DateTime.Now.AddMinutes(60), false, USERTYPE.Expert.ToString());
            // encrypt the cookie using the machine key for secure transport
            string encTicket = FormsAuthentication.Encrypt(authTicket);
            // create and add the cookies to the list for outgoing response
            HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
            Response.Cookies.Add(faCookie);

            ///Here you should have to check whether the user with twitterUserID exists in our database with source= "Twitter"
            ///if Record is Found then Initialize a Session with that data else Create a new user and initialize a Session
            return RedirectToAction("Problem", "User");
        }
        public async Task<ActionResult> BeginAsync()
        {
            //var auth = new MvcSignInAuthorizer
            var auth = new LinqToTwitter.MvcAuthorizer
            {
                CredentialStore = new LinqToTwitter.SessionStateCredentialStore
                {
                    ConsumerKey = ServerSettings.TWITTER_CONSUMER_KEY,
                    ConsumerSecret = ServerSettings.TWITTER_CONSUMER_SECRET
                }
            };

            string twitterCallbackUrl = Request.Url.ToString().Replace("Begin", "Complete");
            return await auth.BeginAuthorizationAsync(new Uri(twitterCallbackUrl));
        }