public static void PopulateIdentifier(Entity booking, BookingIdentifier identifier, ITracingService trace) { if (trace == null) { throw new InvalidPluginExecutionException("Tracing service is null;"); } trace.Trace("Booking Identifier - start"); if (booking == null) { throw new InvalidPluginExecutionException("Booking entity is null."); } if (identifier == null) { throw new InvalidPluginExecutionException("Booking identifier is null."); } if (identifier != null) { trace.Trace("Booking populate identifier - start"); booking[Attributes.Booking.Name] = identifier.BookingNumber; booking[Attributes.Booking.OnTourVersion] = (identifier.BookingVersionOnTour != null) ? identifier.BookingVersionOnTour : string.Empty; booking[Attributes.Booking.TourOperatorVersion] = (identifier.BookingVersionTourOperator != null) ? identifier.BookingVersionTourOperator : string.Empty; booking[Attributes.Booking.OnTourUpdatedDate] = !string.IsNullOrWhiteSpace(identifier.BookingUpdateDateOnTour) ? Convert.ToDateTime(identifier.BookingUpdateDateOnTour) : (DateTime?)null; booking[Attributes.Booking.TourOperatorUpdatedDate] = !string.IsNullOrWhiteSpace(identifier.BookingUpdateDateTourOperator) ? Convert.ToDateTime(identifier.BookingUpdateDateTourOperator) : (DateTime?)null; booking[Attributes.Booking.SourceApplication] = identifier.SourceApplication != SourceApplication.NotSpecified ? identifier.SourceApplication.ToString() : null; booking[Attributes.Booking.SourceSystem] = identifier.BookingSystem.ToString(); booking[Attributes.Booking.DealSequenceNumber] = identifier.DealSequenceNumber; booking[Attributes.Booking.ConsultationReferenceId] = (!string.IsNullOrWhiteSpace(identifier.ConsultationReference)) ? new EntityReference(EntityName.TravelPlanner, new Guid(identifier.ConsultationReference)) : null; booking[Attributes.Booking.SourceSystemId] = CommonXrm.GetSourceSystem(identifier.SourceSystem); trace.Trace("Booking populate identifier - end"); } trace.Trace("Booking Identifier - end"); }