internal void InitFromCreationInformation(UserCreationInformation creation)
 {
     if (creation != null)
     {
         base.ObjectData.Properties["Email"]     = creation.Email;
         base.ObjectData.Properties["LoginName"] = creation.LoginName;
         base.ObjectData.Properties["Title"]     = creation.Title;
     }
 }
        public User Add(UserCreationInformation parameters)
        {
            ClientRuntimeContext context = base.Context;

            if (base.Context.ValidateOnClient)
            {
                if (parameters == null)
                {
                    throw ClientUtility.CreateArgumentNullException("parameters");
                }
                if (parameters != null)
                {
                    if (parameters.LoginName == null)
                    {
                        throw ClientUtility.CreateArgumentNullException("parameters.LoginName");
                    }
                    if (parameters.LoginName != null && parameters.LoginName.Length == 0)
                    {
                        throw ClientUtility.CreateArgumentException("parameters.LoginName");
                    }
                    if (parameters.LoginName != null && parameters.LoginName.Length > 251)
                    {
                        throw ClientUtility.CreateArgumentException("parameters.LoginName");
                    }
                    if (parameters.Title != null && parameters.Title.Length > 255)
                    {
                        throw ClientUtility.CreateArgumentException("parameters.Title");
                    }
                    if (parameters.Email != null && parameters.Email.Length > 255)
                    {
                        throw ClientUtility.CreateArgumentException("parameters.Email");
                    }
                }
            }
            User user = new User(context, new ObjectPathMethod(context, base.Path, "Add", new object[]
            {
                parameters
            }));

            user.Path.SetPendingReplace();
            ObjectIdentityQuery objectIdentityQuery = new ObjectIdentityQuery(user.Path);

            context.AddQueryIdAndResultObject(objectIdentityQuery.Id, user);
            context.AddQuery(objectIdentityQuery);
            base.AddChild(user);
            user.InitFromCreationInformation(parameters);
            return(user);
        }