public static bool Insert(SpellVM Spelling)
        {
            if (Spellings.Any(s => s.Text == Spelling.Text))
            {
                var old_Spell = Spellings.First(s => s.Text == Spelling.Text);
                var old_score = ScoreHelper.GetScoreFromImportance(old_Spell.Importance);
                var new_score = ScoreHelper.GetScoreFromImportance(Spelling.Importance);

                if (new_score > old_score)
                {
                    var to_update = new SpellVM(old_Spell.Id, old_Spell.Text, Spelling.Importance, old_Spell.IsActive);
                    return(Update(to_update));
                }
                else
                {
                    return(Errors.ThrowErrorMsg(ErrorType.AlreadyInserted, Spelling.Text));
                }
            }

            if (!ValidWordsAndAnswerSize(Spelling.Text))
            {
                return(false);
            }

            if (!InsertSpelling(Spelling.ToModel()))
            {
                return(false);
            }

            Spelling.LoadCrossData();

            return(true);
        }
        public static bool Update(SpellVM Spelling)
        {
            if (!ValidWordsAndAnswerSize(Spelling.Text))
            {
                return(false);
            }

            if (!UpdateSpelling(Spelling.ToModel()))
            {
                return(false);
            }


            var oldVM = Spellings.FindIndex(x => x.Id == Spelling.Id);

            Spellings.Insert(oldVM, Spelling);

            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>());
            }
        }