Remove redundant iteration for layouts database