private void detach_Players(Player entity)
		{
			this.SendPropertyChanging();
			entity.Transit = null;
		}
		private void detach_Players(Player entity)
		{
			this.SendPropertyChanging();
			entity.StarSystem = null;
		}
 partial void DeletePlayer(Player instance);
		private void attach_Players(Player entity)
		{
			this.SendPropertyChanging();
			entity.Transit = this;
		}
 partial void UpdatePlayer(Player instance);
 partial void InsertPlayer(Player instance);
		private void detach_Players(Player entity)
		{
			this.SendPropertyChanging();
			entity.CelestialObject = null;
		}
		public static RegisterResponse Register(string login, string password)
		{
			using (var t = new TransactionScope()) {
				var db = new DbDataContext();
				var user = db.SpringAccounts.SingleOrDefault(x => x.Name == login);
				if (user == null) return RegisterResponse.NotValidSpringLogin;

				if (user.Players != null) return RegisterResponse.AlreadyRegistered;

				if (db.SpringAccounts.Any(x => x.UserCookie == user.UserCookie && x.Players != null)) return RegisterResponse.IsSmurf;

				if (user.Password != SpringAccount.HashPassword(password)) return RegisterResponse.NotValidSpringPassword;

				// create player and assign to smallest alliance
				var player = new Player() { IsActive = true, StarSystem = db.StarSystems.OrderBy(x => x.Players.Where(y => y.IsActive).Count()).First() };
				user.Players = player;
				player.MothershipName = player.SpringAccount.Name + "'s mothership";

				// create his planet 
				var mg = new MapGen();
				var hisPlanet = mg.CreateHomeworld(player.StarSystem.CelestialObject);
				hisPlanet.Name = player.SpringAccount.Name + "'s home";
				hisPlanet.Player = player;
				player.StarSystem.CelestialObject.ChildCelestialObjects.Add(hisPlanet);

				hisPlanet.UpdateIncomeInfo();

				db.SubmitChanges();

				var e = db.AddEvent(EventType.Player, "{0} joined the {1}", player.Name, player.StarSystem.Name);
				e.Connect(player);
				e.Connect(hisPlanet);
				db.MarkDirty();
				db.SubmitChanges();
				t.Complete();
				return RegisterResponse.Ok;
			}
		}
		private void detach_ChildPlayers(Player entity)
		{
			this.SendPropertyChanging();
			entity.ParentPlayer = null;
		}