private bool CheckSessionValidity(string key, SalesforceSession session)
        {
            bool valid = DateTime.Now - session.LastLogin > SessionStoragePolicy.SessionStorageExpiration;

            if (!valid)
            {
                _store.Remove(key);
            }

            return(valid);
        }
        public SalesforceSession RetrieveSession(string environment)
        {
            string key = GenerateCacheKey(environment);

            if (!_store.Contains(key))
            {
                return(null);
            }

            SalesforceSession session = (SalesforceSession)_store[key];

            return(CheckSessionValidity(key, session) ? session : null);
        }
        public bool StoreSession(SalesforceSession session)
        {
            string key = GenerateCacheKey(session.Environment ?? "Default");

            if (_store.Contains(key))
            {
                _store.Remove(key);
            }

            return(_store.Add(key, session, new CacheItemPolicy
            {
                AbsoluteExpiration = DateTime.Now.Add(SessionStoragePolicy.SessionStorageExpiration)
            }));
        }