public static bool Insert(VocVM Vocabulary)
        {
            if (Vocabularies.Any(s => s.Text == Vocabulary.Text))
            {
                var old_Voc   = Vocabularies.First(s => s.Text == Vocabulary.Text);
                var old_score = ScoreHelper.GetScoreFromImportance(old_Voc.Importance);
                var new_score = ScoreHelper.GetScoreFromImportance(Vocabulary.Importance);

                if (new_score > old_score)
                {
                    var to_update = new VocVM(old_Voc.Id, old_Voc.Text, old_Voc.Answer, old_Voc.Definition,
                                              old_Voc.PtBr, Vocabulary.Importance, old_Voc.IsActive);
                    return(Update(to_update));
                }
                else
                {
                    return(Errors.ThrowErrorMsg(ErrorType.AlreadyInserted, Vocabulary.Text));
                }
            }

            if (!ValidWordsAndAnswerSize(Vocabulary.Text, Vocabulary.Answer))
            {
                return(false);
            }

            if (!InsertVocabulary(Vocabulary.ToModel()))
            {
                return(false);
            }

            Vocabulary.LoadCrossData();

            return(true);
        }
        public static bool Update(VocVM Vocabulary)
        {
            if (!ValidWordsAndAnswerSize(Vocabulary.Text, Vocabulary.Answer))
            {
                return(false);
            }

            if (!UpdateVocabulary(Vocabulary.ToModel()))
            {
                return(false);
            }


            var oldVM = Vocabularies.FindIndex(x => x.Id == Vocabulary.Id);

            Vocabularies.Insert(oldVM, Vocabulary);

            return(true);
        }
        public static IEnumerable <IQuest> Get(Model type)
        {
            LoadDB(type);

            switch (type)
            {
            case Model.Voc:
                return(Vocabularies.Cast <IQuest>());

            case Model.Pron:
                return(Pronunciations.Cast <IQuest>());

            case Model.Spell:
                return(Spellings.Cast <IQuest>());

            default:
                Errors.ThrowErrorMsg(ErrorType.InvalidModelType, type);
                return(new List <IQuest>());
            }
        }