moved some of the logic into class library

and added to nancy web project