Small optimalization to avoid unnecessary db queries.