public int SetAthlete(int athleteid, int teamid, string name, string gender, string school, string dob)
        {
            if (athleteid == 0)
            {     // new athlete
                if (teamid == 0)
                {
                    return(0);
                }
                if (name == "")
                {
                    return(0);
                }
                if (school == "")
                {
                    return(0);
                }
                if (dob == "")
                {
                    return(0);
                }

                Athlete ath = new StudentAthlete();

                ath.setFullName(System.Web.HttpUtility.UrlDecode(name));

                if (gender == "Male")
                {
                    ath.Gender = Gender.Male;
                }
                else if (gender == "Female")
                {
                    ath.Gender = Gender.Female;
                }
                else
                {
                    ath.Gender = Gender.NotStated;
                }

                Team team = getCurrentChampionship().Teams.ToList().Where(t => t.ID == teamid).FirstOrDefault();

                ath.setTeam(team, getCurrentChampionship( ));

                School sch = (from s in team.HasSchools.ToList() where s.Name == System.Web.HttpUtility.UrlDecode(school) select s).FirstOrDefault();

                if (sch == null)
                {
                    return(0);
                }

                ((StudentAthlete)ath).Attends = sch;

                if (!string.IsNullOrEmpty(dob))
                {
                    DateTime.TryParse(dob, out DateTime DoB);

                    ath.DateOfBirth = DoB;
                }
                else
                {
                    return(0);
                }

                //MainWindow.Context.People.InsertOnSubmit(ath);
                //FileIO.FConnFile.getContext().People.InsertOnSubmit(ath);
                //!*!
                FileIO.FConnFile.GetFileDetails( ).IO.Add <Person> (ath);

                saveChangesToDatabase( );

                return(ath.ID);
            }
            else
            {
                // existing athlete

                // todo

                Athlete origonalAthlete = getAthlete(athleteid);

                if (origonalAthlete == null)
                {
                    return(0);
                }

                if (origonalAthlete.Fullname != System.Web.HttpUtility.UrlDecode(name))
                {
                    origonalAthlete.setFullName(System.Web.HttpUtility.UrlDecode(name));
                }

                School sch = (from s in origonalAthlete.getTeam(getCurrentChampionship()).HasSchools.ToList() where s.Name == System.Web.HttpUtility.UrlDecode(school) select s).FirstOrDefault();

                if (sch == null)
                {
                    return(0);
                }

                if (origonalAthlete is StudentAthlete)
                {
                    ((StudentAthlete)origonalAthlete).Attends = sch;
                }

                if (!string.IsNullOrEmpty(dob))
                {
                    DateTime.TryParse(dob, out DateTime DoB);

                    if (origonalAthlete.DateOfBirth != DoB)
                    {
                        origonalAthlete.DateOfBirth = DoB;
                    }
                }
                else
                {
                    return(0);
                }

                saveChangesToDatabase( );

                return(athleteid);
            }
        }