// TODO : Add code to read cookies data from database and compare. If cookies match update last access time.
 private bool valideClientToken(HttpCookieCollection cookies, string userHostName)
 {
     try
     {
         Logger.LogInfo("Validate client token process start.");
         UserSession        userSession        = new UserSession();
         bool               isValidSession     = false;
         UserSessionService userSessionService = new UserSessionService();
         if (cookies != null)
         {
             for (int i = 0; i <= cookies.Keys.Count - 1; i++)
             {
                 var cookieKey = cookies.Keys.Get(i);
                 if (cookieKey == WebApiApplication.USERNAME)
                 {
                     userSession = userSessionService.Get(int.Parse(cookies[i].Value));
                 }
                 if (cookieKey == WebApiApplication.CLIENT_Token &&
                     cookies[i].Value == userSession.UserToken &&
                     DateTime.Now < userSession.ExpireOn)
                 {
                     userSession.LastPingTime = DateTime.Now;
                     userSession.MachineName  = userHostName;
                     isValidSession           = true;
                 }
             }
         }
         if (isValidSession)
         {
             userSessionService.UpdateSession(userSession);
         }
         else
         {
             Logger.LogInfo("Invalid client token.");
         }
         Logger.LogInfo("Validate client token process completed.");
         return(isValidSession);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         return(false);
     }
 }
        private async Task <ResponseModel> GetContentModel(string currentRequestFolder)
        {
            // TODO: we don't even need session now, which means we also don't need async/await...
            var updatedSession = await _sessionService.UpdateSession(new UserSessionUpdateModel { CurrentFolder = currentRequestFolder, });

            var currentFolder = currentRequestFolder.MapContentFolder();
            var folders       = currentRequestFolder.GetFolders();
            var files         = await currentRequestFolder.GetFiles();

            await UpdateInfo(currentRequestFolder, files.Select(file => file.Name));

            var deletedFiles = await GetDeletedFiles(currentRequestFolder);

            // TODO: really wanted to use .Except here to filter ...
            var filteredFiles = files.Where(file => !deletedFiles.Any(deleted => deleted.Name == file.Name));
            var links         = new StringDictionary {
                { "Folder", "api/content/folder" },
            };

            Console.WriteLine($"current folder: {currentFolder}");
            return(new ResponseModel {
                Id = updatedSession.SessionId, CurrentFolder = currentFolder, Folders = folders, Files = filteredFiles, Links = links,
            });
        }