RequestResponse Map(tblRequestResponce rp)
        {
            if (rp == null) return null;
            RequestResponse response = new RequestResponse
                                           {
                                               messageId = rp.MessageId,
                                               statusCode = rp.StatusCode,
                                               statusDetail = rp.StatusDetails,
                                               version = rp.Vesion,
                                           };
            foreach (var item in rp.tblRequestResponceDestination)
            {
                DestinationResponse dr = Map(item);
                response.DesinationResponses.Add(dr);
            }
            return response;


        }
 public int Save(RequestResponse entity)
 {
     tblRequestResponce tblresponse = new tblRequestResponce();
     tblresponse.DateCreated = DateTime.Now;
     tblresponse.MessageId = entity.messageId;
     tblresponse.ReferenceId = entity.ReferenceId;
     tblresponse.StatusCode = entity.statusCode;
     tblresponse.StatusDetails = entity.statusDetail;
     tblresponse.Vesion = entity.version;
     foreach (DestinationResponse edest in entity.DesinationResponses)
     {
         tblRequestResponceDestination dest = new tblRequestResponceDestination();
         dest.Address = edest.address;
         dest.DateCreated = DateTime.Now;
         dest.ResponseTimeStamp = edest.timeStamp;
         dest.StatusCode = edest.statusCode;
         dest.StatusDetails = edest.statusDetail;
         dest.MessageId = edest.messageId;
         tblresponse.tblRequestResponceDestination.Add(dest);
     }
     _ctx.tblRequestResponce.Add(tblresponse);
     _ctx.SaveChanges();
     return tblresponse.Id;
 }