public static void SaveCharacter(Character character)
        {
            string newList = "";
            using (StreamReader file = File.OpenText(dataPath))
            {
                JsonSerializer serializer = new JsonSerializer();

            IList<Character> characters = (IList<Character>)serializer.Deserialize(file, typeof(IList<Character>));
                if (characters != null)
                {
                    var oldCharacter = characters.FirstOrDefault(c => c.Name == character.Name);

                    if (oldCharacter != null)
                        characters.Remove(oldCharacter);
                }
                else
                    characters = new List<Character>();

            characters.Insert(0, character);
                newList = JsonConvert.SerializeObject(characters, Formatting.Indented, new JsonSerializerSettings()
            {
              ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });
            }
            File.WriteAllText(dataPath, newList);
        }
        public IList<Companion> GetAvailableCompanions(Character character)
        {
            IList<Companion> allCompanions = CompanionProvider.GetCompanions()
            .OrderBy(c => c.FirstName).ToList();
            if (character == null || character.Companions.IsEmpty())
                return allCompanions;

            var characterCompanions = character.Companions.Select(o => new Companion()
            {
                FirstName = o.Companion.FirstName,
                LastName = o.Companion.LastName,
                PortraitSource = o.Companion.PortraitSource
            }).ToList();

            // TODO: write an equality comparer and use except method.
            return allCompanions
                .Where(o =>
                    !characterCompanions
                    .Any(c =>
                        c.FirstName == o.FirstName))
                        .ToList();
        }