public void Insert(Requirement item, bool saveImmediately = true)
        {
            if (_requirements.Exists(p => p.Code == item.Code))
                throw new Exception("Can't insert the data as the object has already existed.");

            _requirements.Add(item);

            if (File.Exists(GetCombinePath(item)))
            {
                File.Delete(GetCombinePath(item));
            }
            using (var streamWriter = new StreamWriter(GetCombinePath(item)))
            {
                streamWriter.Write(item.Context);
            }
        }
        public void Update(Requirement item, bool saveImmediately = true)
        {
            _requirements.Find(requirement => requirement.Code == item.Code).Context = item.Context;

            if (File.Exists(GetCombinePath(item)))
            {
                File.Delete(GetCombinePath(item));
            }
            using (var streamWriter = new StreamWriter(GetCombinePath(item)))
            {
                streamWriter.Write(item.Context);
            }
        }
 public void Delete(Requirement item, bool saveImmediately = true)
 {
     _requirements.Remove(item);
     File.Delete(GetCombinePath(item));
 }
 private string GetCombinePath(Requirement item)
 {
     return Path.Combine(WorkDirectory, item.Code + Extension);
 }