public Task<IdentityManagerMetadata> GetMetadataAsync()
        {
            var properties = new[] {
                new PropertyMetadata { DataType = PropertyDataType.String, Name = "User Name", Required = true, Type = Core.Constants.ClaimTypes.Name },
                new PropertyMetadata { DataType = PropertyDataType.Password, Name = "Password", Required = true, Type = Core.Constants.ClaimTypes.Password },
                new PropertyMetadata { DataType = PropertyDataType.Email, Name = "Email", Required = false, Type = Core.Constants.ClaimTypes.Email }
            };

            var meta = new IdentityManagerMetadata
            {
                UserMetadata = new UserMetadata
                {
                    SupportsClaims = true,
                    SupportsCreate = true,
                    SupportsDelete = true,
                    CreateProperties = properties,
                    UpdateProperties = properties
                },
                RoleMetadata = new RoleMetadata
                {
                    SupportsCreate = false,
                    SupportsDelete = false,
                    RoleClaimType = "role",
                    CreateProperties = Enumerable.Empty<PropertyMetadata>(),
                    UpdateProperties = Enumerable.Empty<PropertyMetadata>()
                }
            };

            return Task.FromResult(meta);
        }
        IdentityManagerMetadata GetMetadata()
        {
            if (metadata == null)
            {
                var createprops = new List<PropertyMetadata>()
                {
                    PropertyMetadata.FromProperty<InMemoryUser>(x => x.Username, type:Constants.ClaimTypes.Username, required:true),
                };

                var updateprops = new List<PropertyMetadata>();
                updateprops.AddRange(new PropertyMetadata[]{
                    PropertyMetadata.FromProperty<InMemoryUser>(x => x.Username, type:Constants.ClaimTypes.Username, required:true),
                    PropertyMetadata.FromPropertyName<InMemoryUser>("Password", type:Constants.ClaimTypes.Password, required:true),
                    PropertyMetadata.FromFunctions<InMemoryUser, string>(Constants.ClaimTypes.Name, this.GetName, this.SetName, name:"Name", required:true),
                });
                updateprops.AddRange(PropertyMetadata.FromType<InMemoryUser>());
                updateprops.AddRange(new PropertyMetadata[]{
                    PropertyMetadata.FromPropertyName<InMemoryUser>("Mobile"),
                    PropertyMetadata.FromPropertyName<InMemoryUser>("Email", dataType:PropertyDataType.Email),
                    new PropertyMetadata {
                        Name = "Is Administrator",
                        Type = "role.admin",
                        DataType = PropertyDataType.Boolean,
                        Required = true,
                    },
                    new PropertyMetadata {
                        Name = "Gravatar Url",
                        Type = "gravatar",
                        DataType = PropertyDataType.Url,
                    }
                });

                var roleCreateProps = new List<PropertyMetadata>();
                roleCreateProps.Add(PropertyMetadata.FromProperty<InMemoryRole>(x => x.Name));
                var roleUpdateProps = new List<PropertyMetadata>();
                roleUpdateProps.Add(PropertyMetadata.FromProperty<InMemoryRole>(x => x.Description, type: "description"));

                metadata = new IdentityManagerMetadata()
                {
                    UserMetadata = new UserMetadata
                    {
                        SupportsCreate = true,
                        SupportsDelete = true,
                        SupportsClaims = true,
                        CreateProperties = createprops,
                        UpdateProperties = updateprops
                    },
                    RoleMetadata = new RoleMetadata
                    {
                        RoleClaimType = Constants.ClaimTypes.Role,
                        SupportsCreate = true,
                        SupportsDelete = true,
                        CreateProperties = roleCreateProps,
                        UpdateProperties = roleUpdateProps
                    }
                };
            }
            return metadata;
        }