/// <summary>
        /// Saves the run detail.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public DiagnosticsRunDetailItem SaveRunDetail(DiagnosticsRunDetailItem item)
        {
            var map = new DiagnosticsRunDetailItemMapper();

            try
            {
                using (var scp = new TransactionScope())
                {
                    if (FindRunDetail(item.Id) == null)
                    {
                        DiagnosticsRepositoryAgentFactory
                        .CreateDiagnosticsRunDetailRepositoryAgent()
                        .Insert(map.MapFromBusinessToService(item));
                    }
                    else
                    {
                        DiagnosticsRepositoryAgentFactory
                        .CreateDiagnosticsRunDetailRepositoryAgent()
                        .Update(map.MapFromBusinessToService(item));
                    }
                    scp.Complete();
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    item.AddError(ex.InnerException.Message);
                }
                item.AddError(ex.Message);
            }
            return(item);
        }
        /// <summary>
        /// Finds the run detail.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public DiagnosticsRunDetailItem FindRunDetail(string id)
        {
            var map = new DiagnosticsRunDetailItemMapper();
            var res = DiagnosticsRepositoryAgentFactory
                      .CreateDiagnosticsRunDetailRepositoryAgent()
                      .SelectById(id);

            return(res == null ? null : map.MapFromServiceToBusiness(res));
        }
 /// <summary>
 /// Gets the diagnostics details for run.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public DiagnosticsRunDetailItem[] GetDiagnosticsDetailsForRun(string id)
 {
     using (var scp = new TransactionScope())
     {
         var res = DiagnosticsRepositoryAgentFactory
                   .CreateDiagnosticsRunDetailRepositoryAgent()
                   .SelectByRunId(id);
         scp.Complete();
         var map = new DiagnosticsRunDetailItemMapper();
         return(map.MapFromServiceToBusiness(res));
     }
 }