Moving directory permission checks to repository creation. Adding findById method