nested resources database layout