Add models middleware