public HandlingEvent createHandlingEvent(DateTime completionTime, TrackingId trackingId,
VoyageNumber voyageNumber, UnLocode unlocode,
HandlingActivityType type, OperatorCode operatorCode)
{
var cargo = findCargo(trackingId);
var voyage = findVoyage(voyageNumber);
var location = findLocation(unlocode);
try
{
var registrationTime = DateTime.Now;
if(voyage == null)
{
return new HandlingEvent(cargo, completionTime, registrationTime, type, location);
}
else
{
return new HandlingEvent(cargo, completionTime, registrationTime, type, location, voyage, operatorCode);
}
}
catch(Exception e)
{
throw new CannotCreateHandlingEventException(e.Message, e);
}
}