public void Apply(ProfileElements e, User u)
        {
            if (e.Email)
            {
                u.Email = Email;
            }
            if (e.Name)
            {
                u.FirstName = FirstName;
                u.LastName = LastName; 
            }
            if (e.DateOfBirth) 
            {
                u.DateBirth = DateBirth;
            }
            if (e.DateOfHire)
            {
                u.DateHired = DateHired;
            }
            if (e.HomeAddress)
            {
                u.HomeAddress = HomeAddress;
            }
            if (e.WorkAddress)
            { 
                u.WorkAddress = WorkAddress;
            }
            if (e.HomePhone)
            {
                u.HomePhone = HomePhone;
            }
            if (e.WorkPhone)
            {
                u.WorkPhone = WorkPhone;
            }
            if (e.MobilePhone)
            {
                u.MobilePhone = MobilePhone;
            }
            if (e.CustomFields)
            { 
                u.Custom = Custom;
            }
            if (e.Password &&
                !String.IsNullOrEmpty(Password) &&
                !String.IsNullOrEmpty(PasswordConfirmation) &&
                Password == PasswordConfirmation)
            {
                u.SetPassword(Password);
            }

            u.LastUpdatedProfile = DateTime.UtcNow;
        }
 public static ProfileEditModel FromDomain(ProfileElements elements, string[] custom, User u)
 {
     return new ProfileEditModel()
     {
         Elements = elements,
         Login = u.Login,
         Email = u.Email,
         FirstName = u.FirstName,
         LastName = u.LastName,
         DateBirth = u.DateBirth,
         DateHired = u.DateHired,
         HomeAddress = u.HomeAddress,
         WorkAddress = u.WorkAddress,
         HomePhone = u.HomePhone,
         WorkPhone = u.WorkPhone,
         MobilePhone = u.MobilePhone,
         Custom = custom.ToDictionary(
             x => x,
             x => (u.Custom != null && u.Custom.ContainsKey(x)) ? u.Custom[x] : ""),
     };
 }