/// <summary>
/// Create an account with the specified account name and profile.
/// <para>The profile is validated for consistency and rejected if
/// validation fails.</para>
/// <para>The new account is registered in the Portal log under
/// AccountName@Domain as the unique identifier. The profile is
/// registered in the mesh under the </para>
/// </summary>
/// <param name="AccountID">The requested account name.</param>
/// <param name="Profile">A signed Personal Profile.</param>
/// <returns>True if the transaction was successful, otherwise false. </returns>
public bool CreateAccount(string AccountID, SignedProfile Profile) {
// Validate the signed profile
if (!Profile.Validate()) throw new Throw ("Profile not valid");
// Create the new account on the portal (fail if already exists)
var Account = new Account();
Account.AccountID = AccountID;
Account.Status = "Open";
Account.Created = DateTime.Now;
Account.Modified = Account.Created;
Account.UserProfileUDF = Profile.Identifier;
//// Allow accounts to be searched by the profile they link to:
//var KeyData = new IndexTerm(KeyUserProfile, Account.UniqueID);
//var KeyDatas = new List<IndexTerm> { KeyData };
PortalStore.New(Account, Account.PrimaryKey(Account.UniqueID), null);
// Push the profile out to the Mesh
MeshStore.New(Profile, Profile.Identifier, null);
return true;
}