/// <summary>
        /// Queries a given commit point of a store using a SPARQL query
        /// </summary>
        /// <param name="commitPoint">The store commit point to be queried</param>
        /// <param name="queryExpression">The SPARQL query string</param>
        /// <param name="resultsMediaType">The media type for the serialization of the SPARQL results</param>
        /// <returns>A stream containing the serialized query results</returns>
        public Stream ExecuteQueryOnCommitPoint(CommitPointInfo commitPoint, string queryExpression, string resultsMediaType = null)
        {
            try
            {
                var resultsFormat = resultsMediaType == null ? SparqlResultsFormat.Xml : SparqlResultsFormat.GetResultsFormat(resultsMediaType);
                var pstream = new MemoryStream();
                var t = new Task(() => ServerCore.Query(commitPoint.StoreName, commitPoint.Id, queryExpression, resultsFormat, pstream));
                t.Start();
                t.Wait();
                if (t.IsFaulted && t.Exception != null) throw t.Exception;
                var cStream = new MemoryStream(pstream.GetBuffer(), 0, (int) pstream.Length);
                return cStream;
            }
            catch (Exception ex)
            {
                Logging.LogError(BrightstarDB.BrightstarEventId.ServerCoreException, "Error executing query {0}@{1} {2}", commitPoint.StoreName, commitPoint.Id, queryExpression);
                throw new BrightstarClientException(
                    String.Format("Error executing query {0}@{1} {2}. {3}", commitPoint.StoreName, commitPoint.Id,
                                  queryExpression, ex.Message), ex);
            }

        }
 public void RevertToCommitPoint(string storeName, CommitPointInfo commitPoint)
 {
     try
     {
         ServerCore.RevertToCommitPoint(storeName, commitPoint.Id);
     }
     catch (Exception ex)
     {
         Logging.LogError(BrightstarDB.BrightstarEventId.ServerCoreException, "Error getting commit points for store {0}", storeName);
         throw new BrightstarClientException("Error getting commit points for store " + storeName + ". " + ex.Message, ex);
     }            
 }
 public JobInfo CreateSnapshot(string sourceStoreName, string targetStoreName, PersistenceType persistenceType, CommitPointInfo sourceCommitPoint)
 {
     try
     {
         var jobId = ServerCore.CreateSnapshot(sourceStoreName, targetStoreName, persistenceType, sourceCommitPoint == null ? StoreConstants.NullUlong : sourceCommitPoint.Id);
         return new JobInfo {JobId = jobId.ToString(), JobPending = true};
     }
     catch (Exception ex)
     {
         Logging.LogError(BrightstarEventId.ServerCoreException,
             "Error starting snapshot for store {0}", sourceStoreName);
         throw new BrightstarClientException(
             "Error starting snapshot for store " + sourceStoreName + ". " + ex.Message, ex);
     }
 }