Implementation of QueryOne method