/// <summary>
        /// Creates transports based on the given set of templates
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="templates"></param>
        /// <returns></returns>
        public int CreateTransport( PlanningFilter filter, List<RecTransport> templates )
        {
            if( filter == null )
            {
                throw new ArgumentNullException( "Transport" );
            }
            // Load template details 
            LoadTemplateDetails( templates );

            TMLoader loader = new TMLoader();
            List<TMTransport> transportList = new List<TMTransport>();
            loader.CreateTransportFromTemplate( filter, templates, 0, transportList );
            loader.SaveToDb( transportList, true );
            return transportList.Count;
        }
        /// <summary>
        /// Automatic transportation management
        /// </summary>
        /// <returns></returns>
        public int AutoTransport( PlanningFilter filter, List<RecTransport> templates, List<RecTMElement> elements )
        {
            if( filter == null )
            {
                throw new ArgumentNullException( "Transport" );
            }
            elements = GetUntransportedElement( filter.Factory, filter.Project, elements );
            if( elements == null || elements.Count == 0 )
            {
                return 0;
            }

            elements.Sort( RecTMElement.CompareErectionSequence );

            // Load template details 
            LoadTemplateDetails( templates );

            bool generateErectionSequence = false;
            TMLoader loader = new TMLoader();
            return loader.Load( elements, templates, filter, generateErectionSequence );
        }