public void Handle(ProjectRegistered @event)
 {
     using (var session = _documentStore.OpenSession())
     {
         var projectTreeNode = new ProjectTreeNode(@event.ProjectId, @event.Title, @event.Deadline,
                                                   @event.Priority, 0);
         session.Store(projectTreeNode);
         session.SaveChanges();
     }
 }
        public string Handle(ProjectIdByTitleQuery query)
        {
            using (var session = _documentStore.OpenSession())
            {
                ProjectTreeNode projectTreeNode = session.Query <ProjectTreeNode>().FirstOrDefault(x => x.Title == query.Title);

                if (projectTreeNode == null)
                {
                    return(null);
                }
                return(projectTreeNode.Id);
            }
        }