A Generalized Discrete Event Model to Support Railway Freights Logistics: Methodology and Case Study