// select ///////////////////////////////////////////////////////////

        /// <returns>
        ///     the latest version of the process definition with the given key (from any tenant)
        /// </returns>
        /// <exception cref="ProcessEngineException">
        ///     if more than one tenant has a process definition with the given key
        /// </exception>
        /// <seealso cref= FindLatestProcessDefinitionByKeyAndTenantId( String, String
        /// )
        /// </seealso>
        public virtual ProcessDefinitionEntity FindLatestProcessDefinitionByKey(string processDefinitionKey)
        {
            //IList<ProcessDefinitionEntity> processDefinitions =ListExt.ConvertToListT< ProcessDefinitionEntity>(DbEntityManager.SelectList("selectLatestProcessDefinitionByKey", ConfigureParameterizedQuery(processDefinitionKey)));
            var lastProcessDefinitionVersion = Find(m => m.Key == processDefinitionKey)
                                               .OrderByDescending(m => m.Version)
                                               .FirstOrDefault();

            if (lastProcessDefinitionVersion == null)
            {
                return(null);
            }
            IList <ProcessDefinitionEntity> processDefinitions =
                Find(m => m.Key == processDefinitionKey && m.Version == lastProcessDefinitionVersion.Version)
                .ToList();

            if (processDefinitions.Count == 0)
            {
                return(null);
            }
            if (processDefinitions.Count >= 1)
            {
                return(processDefinitions[0]);
            }
            throw Log.MultipleTenantsForProcessDefinitionKeyException(processDefinitionKey);
        }