public void Load(IMoBiContext context, string projectFullPath)
        {
            try
            {
                _projectConverterLogger.Clear();
                _sessionManager.OpenFactoryFor(projectFullPath);
                using (_sessionManager.OpenSession())
                {
                    //load history first so that possible conversion command can be added to history
                    context.HistoryManager = _historyManagerPersistor.Load(_sessionManager.CurrentSession) as IMoBiHistoryManager;

                    var project = _projectPersistor.Load(context);

                    if (project == null)
                    {
                        return;
                    }

                    project.FilePath   = projectFullPath;
                    project.Name       = FileHelper.FileNameFromFileFullPath(projectFullPath);
                    project.HasChanged = false;

                    LoadJournal(context, project.JournalPath, projectFullPath);
                }
            }
            catch (Exception)
            {
                // Exeption occurs while opening the project!
                // close the file and rethrow the exception
                _sessionManager.CloseFactory();
                context.Clear();
                throw;
            }

            var notificationMessages = _projectConverterLogger.AllMessages();

            if (notificationMessages.Any())
            {
                _eventPublisher.PublishEvent(new ShowNotificationsEvent(new ReadOnlyCollection <NotificationMessage>(notificationMessages.ToList())));
            }
        }
        public IEnumerable <T> LoadMany <T>(string fileName, bool resetIds = false)
        {
            _projectConverterLogger.Clear();

            XElement xelRoot = XElement.Load(fileName);

            if (string.IsNullOrEmpty(fileName))
            {
                return(Enumerable.Empty <T>());
            }

            var possibleElementsToDeserialize = retrieveElementsToDeserializeFromFile <T>(xelRoot, fileName).ToList();

            var selection = possibleElementsToDeserialize.Count > 1
            ? selectToDeserialize(possibleElementsToDeserialize, _objectTypeResolver.TypeFor <T>())
            : possibleElementsToDeserialize;

            if (!selection.Any())
            {
                return(Enumerable.Empty <T>());
            }

            var deserializedObjects = new List <T>();
            int version             = _xmlSerializationService.VersionFrom(xelRoot);
            var currentProject      = _context.CurrentProject;

            selection.Each(element => deserializedObjects.Add(_xmlSerializationService.Deserialize <T>(element, currentProject, version)));

            var notificationMessages = _projectConverterLogger.AllMessages().ToList();

            if (notificationMessages.Any())
            {
                _context.PublishEvent(new ShowNotificationsEvent(notificationMessages));
            }

            _postSerializationSteps.PerformPostDeserializationFor(deserializedObjects, version, resetIds);

            return(deserializedObjects);
        }