public void SaveEntries(HttpContext context, RequestEntryCollection collection)
        {
            string json = JsonConvert.SerializeObject(collection);

            byte[] serializedResult = System.Text.Encoding.UTF8.GetBytes(json);

            context.Session.Set("RequestEntries", serializedResult);
        }
        public RequestEntryCollection GetOrCreateEntries(HttpContext context)
        {
            RequestEntryCollection collection = null;

            byte[] requestEntriesBytes;
            context.Session.TryGetValue("RequestEntries", out requestEntriesBytes);
            if (requestEntriesBytes != null && requestEntriesBytes.Length > 0)
            {
                string json = System.Text.Encoding.UTF8.GetString(requestEntriesBytes);
                return(JsonConvert.DeserializeObject <RequestEntryCollection>(json));
            }
            if (collection == null)
            {
                collection = new RequestEntryCollection();
            }
            return(collection);
        }