private void SaveRecord()
        {
            if (EnhancementRecordChanged == true || HasDataChanged() == true)
            {
                //Update the Enhancement Record
                if (NewEnhancementRecord == true)
                {
                    EnhancementModels[EnhancementIndexLoaded].EnhancementSlotId = SlotModel.Id;
                }

                EnhancementModels[EnhancementIndexLoaded].Save();

                //Update the Enhancement Rank Record(s)
                for (int i = 0; i < RankModels[EnhancementIndexLoaded].Count; i++)
                {
                    RankModels[EnhancementIndexLoaded][i].EnhancementId = EnhancementModels[EnhancementIndexLoaded].Id;
                    RankModels[EnhancementIndexLoaded][i].Rank          = (byte)(i + 1);
                    RankModels[EnhancementIndexLoaded][i].Save();
                    switch (i)
                    {
                    case 0:
                    {
                        if (RankRequirementsRP1.HaveRecordsChanged() == true)
                        {
                            RankRequirementsRP1.RecordId = RankModels[EnhancementIndexLoaded][i].Id;
                            RankRequirementsRP1.SaveRecords();
                        }
                        if (RankModifiersMP1.HaveRecordsChanged() == true)
                        {
                            RankModifiersMP1.RecordId = RankModels[EnhancementIndexLoaded][i].Id;
                            RankModifiersMP1.SaveRecords();
                        }
                        break;
                    }

                    case 1:
                    {
                        if (RankRequirementsRP2.HaveRecordsChanged() == true)
                        {
                            RankRequirementsRP2.RecordId = RankModels[EnhancementIndexLoaded][i].Id;
                            RankRequirementsRP2.SaveRecords();
                        }
                        if (RankModifiersMP2.HaveRecordsChanged() == true)
                        {
                            RankModifiersMP2.RecordId = RankModels[EnhancementIndexLoaded][i].Id;
                            RankModifiersMP2.SaveRecords();
                        }
                        break;
                    }

                    case 2:
                    {
                        if (RankRequirementsRP3.HaveRecordsChanged() == true)
                        {
                            RankRequirementsRP3.RecordId = RankModels[EnhancementIndexLoaded][i].Id;
                            RankRequirementsRP3.SaveRecords();
                        }
                        if (RankModifiersMP3.HaveRecordsChanged() == true)
                        {
                            RankModifiersMP3.RecordId = RankModels[EnhancementIndexLoaded][i].Id;
                            RankModifiersMP3.SaveRecords();
                        }
                        break;
                    }
                    }
                }
            }
        }
        private bool HasDataChanged()
        {
            if (SlotRecordChanged == true)
            {
                return(true);
            }

            if (EnhancementRecordChanged == true)
            {
                return(true);
            }

            if (RankRequirementsRP1.HaveRecordsChanged() == true || RankRequirementsRP2.HaveRecordsChanged() == true || RankRequirementsRP2.HaveRecordsChanged() == true)
            {
                return(true);
            }

            if (RankModifiersMP1.HaveRecordsChanged() == true || RankModifiersMP2.HaveRecordsChanged() == true || RankModifiersMP3.HaveRecordsChanged() == true)
            {
                return(true);
            }

            //no data has changed, so return false.
            return(false);
        }