Filter data before going to db