private SendDeliveryResponse CallSendDelivery(SendDeliveryRequest request)
 {
     if (channel == null || channel.State != CommunicationState.Opened)
     {
         var rc = CallOpen();
         if (LastRC != ZustellServiceRC.OK)
         {
             return null;
         }
     }
     return CallService(() => client.SendDelivery(request));
 }
        public SendDeliveryResponse SendDelivery(SendDeliveryRequestType toSend)
        {
            SendDeliveryRequest resp = new SendDeliveryRequest(toSend);
            LastRC = ZustellServiceRC.OK;

            toSend.Sender.Edid = _certService.EdID;
            Log.Debug("Request: {@SendDeliveryRequestType}", CallerInfo.Create(), toSend);
            SendDeliveryRequest req = new SendDeliveryRequest() { SendDelivery = toSend };
            var deliverResponse = CallSendDelivery(req);
            if (LastRC == ZustellServiceRC.OK)
            {
                Log.Debug("Response: {@SentDeliveryType}", CallerInfo.Create(), deliverResponse.SentDelivery);
                return deliverResponse;
            }
            return new SendDeliveryResponse();
        }