Function which returns record