implemented RavenDB_2716 and RavenDB_2717

for more details see :
http://issues.hibernatingrhinos.com/issue/RavenDB-2716
http://issues.hibernatingrhinos.com/issue/RavenDB-2717