/// <summary>
        ///     remove trainee
        /// </summary>
        /// <param name="traineeToDelete"></param>
        public void RemoveTrainee(Trainee traineeToDelete)
        {
            if (XML.GetAllTraineesFromXml(_traineesXml).All(x => x.Id != traineeToDelete.Id))
            {
                throw new Exception("Trainee doesn't exist");
            }

            _traineesXml.Elements().First(x => x.Element("id")?.Value == traineeToDelete.Id.ToString()).Remove();
            _traineesXml.Save(Configuration.TraineesXmlFilePath);
            _traineeChanged = true;
        }
        /// <summary>
        ///     Add trainee
        /// </summary>
        /// <param name="newTrainee"></param>
        public void AddTrainee(Trainee newTrainee)
        {
            if (XML.GetAllTraineesFromXml(_traineesXml).Any(t => t.Id == newTrainee.Id))
            {
                throw new Exception("The trainee already exist in the system");
            }

            _traineesXml.Add(XML.ConvertTraineeToXml(newTrainee));
            _traineesXml.Save(Configuration.TraineesXmlFilePath);
            _traineeChanged = true;
        }
        /// <summary>
        ///     update an existing trainee
        /// </summary>
        /// <param name="updatedTrainee"></param>
        public void UpdateTrainee(Trainee updatedTrainee)
        {
            if (XML.GetAllTraineesFromXml(_traineesXml).All(x => x.Id != updatedTrainee.Id))
            {
                throw new Exception("Trainee doesn't exist");
            }

            _traineesXml.Elements().First(x => x.Element("id").Value == updatedTrainee.Id.ToString()).Remove();
            _traineesXml.Add(XML.ConvertTraineeToXml(updatedTrainee));
            _traineesXml.Save(Configuration.TraineesXmlFilePath);
            _traineeChanged = true;
        }
        /// <summary>
        ///     DalImp c-tor
        /// </summary>
        internal DalImp()
        {
            try
            {
                //initialize trainees
                if (File.Exists(Configuration.TraineesXmlFilePath))
                {
                    _traineesXml = XElement.Load(Configuration.TraineesXmlFilePath);
                }
                else
                {
                    _traineesXml = new XElement("trainees");
                }
                _trainees = XML.GetAllTraineesFromXml(_traineesXml).ToList();

                //initialize testers
                if (File.Exists(Configuration.TestersXmlFilePath))
                {
                    _testersXml = XElement.Load(Configuration.TestersXmlFilePath);
                }
                else
                {
                    _testersXml = new XElement("testers");
                }
                _testers = XML.GetAllTestersFromXml(_testersXml).ToList();

                //initialize tests
                if (File.Exists(Configuration.TestsXmlFilePath))
                {
                    _tests = XML.DeSerializeTestFromXml().ToList();
                }
                else
                {
                    _tests = new List <Test>();
                }

                //Load configurations
                _config = XML.LoadConfigurations();
            }
            catch
            {
                //do nothing
            }
        }