Fixed filtering by database from model with input.