public bool IsValid()
        {
            if (_session == null)
            {
                return(false);
            }

            var soapTimeStamp = _soapMessageSerializer.ExtractSoapTimestamp(_session.Xml);

            if (soapTimeStamp == null)
            {
                return(false);
            }

            var now = DateTime.UtcNow;

            return(soapTimeStamp.Expires >= now);
        }
        public IActionResult Index()
        {
            var session = _sessionStore.GetSession();

            if (session == null)
            {
                return(new NotFoundResult());
            }

            var timeStamp = _soapMessageSerializer.ExtractSoapTimestamp(session.Xml);

            if (timeStamp == null)
            {
                _sessionStore.StoreSession((Session)null);
                return(this.BuildError(Constants.ErrorCodes.Server, Constants.ErrorMessages.InvalidSession));
            }

            return(new JsonResult(new { created = timeStamp.Created, expires = timeStamp.Expires }));
        }