public LibrarySubscription(CustomerMessageService customerMessageService)
 {
     Name = "Subscription";
     AddField(new EventStreamFieldType
     {
         Name       = "customerAdded",
         Type       = typeof(CustomerAddedMessageType),
         Resolver   = new FuncFieldResolver <CustomerAddedMessage>(c => c.Source as CustomerAddedMessage),
         Subscriber = new EventStreamResolver <CustomerAddedMessage>(c => customerMessageService.GetMessages())
     });
 }
        public LibraryMutation(ICustomerRepository customerRepository, CustomerMessageService customerMessageService)
        {
            FieldAsync <CustomerType>(
                "createCustomer",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <CustomerInputType> > {
                Name = "customer"
            }),                                                                                                              //Mutation musi mat ako parameter Input graph type
                resolve: async context =>
            {
                var customer = context.GetArgument <Customer>("customer");
                //return await context.TryAsyncResolve(async c => await customerRepository.AddCustomer(customer));

                await customerRepository.AddCustomer(customer);
                customerMessageService.AddCustomerAddedMessage(customer);
                return(customer);
            }
                );
        }