public ListenTo.Shared.DO.UserProfile SaveUserProfile(ListenTo.Shared.DO.UserProfile userProfile)
        {
            Guid userId = userProfile.ID;

            ListenTo.Data.LinqToSQL.User dbUser = DBContext.Users.Where(x => x.ID == userProfile.ID).SingleOrDefault();

            if (dbUser == null)
            {
                throw new Exception("UserProfile cannot be saved since parent user does not exist");
            }

            dbUser.Forename = userProfile.Forename;
            dbUser.Surname = userProfile.Surname;
            dbUser.RecievesNewsletter = userProfile.RecievesNewsletter;
            dbUser.Profile = userProfile.Profile;

            if (userProfile.ProfileImage!=null)
            {
                dbUser.AvatarImageID = userProfile.ProfileImage.ID;
            }
            else
            {
                dbUser.AvatarImageID = null;
            }

            //Remove existing user styles
            IQueryable<ListenTo.Data.LinqToSQL.UsersPreferredStyle> userPreferredStyles = DBContext.UsersPreferredStyles.Where(x => x.UserID == userProfile.ID);
            DBContext.UsersPreferredStyles.DeleteAllOnSubmit(userPreferredStyles);

            //Adapt new styles
            IList<UsersPreferredStyle> prefStyles = new List<UsersPreferredStyle>();
            foreach(ListenTo.Shared.DO.Style s in userProfile.Styles){
                UsersPreferredStyle prefStyle = new UsersPreferredStyle();
                prefStyle.StyleID = s.ID;
                prefStyle.UserID = userId;
                prefStyles.Add(prefStyle);
            }

            DBContext.UsersPreferredStyles.InsertAllOnSubmit(prefStyles);

            DBContext.SubmitChanges();

            return userProfile;
        }
 partial void DeleteUsersPreferredStyle(UsersPreferredStyle instance);
 partial void UpdateUsersPreferredStyle(UsersPreferredStyle instance);
 partial void InsertUsersPreferredStyle(UsersPreferredStyle instance);
		private void detach_UsersPreferredStyles(UsersPreferredStyle entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
		private void attach_UsersPreferredStyles(UsersPreferredStyle entity)
		{
			this.SendPropertyChanging();
			entity.Style = this;
		}