public virtual ProcessDefinitionEntity FindProcessDefinitionByKeyVersionAndTenantId(string processDefinitionKey,
                                                                                            int?processDefinitionVersion, string tenantId)
        {
            //IDictionary<string, object> parameters = new Dictionary<string, object>();
            //parameters["processDefinitionVersion"] = processDefinitionVersion;
            //parameters["processDefinitionKey"] = processDefinitionKey;
            //parameters["tenantId"] = tenantId;
            //IList<ProcessDefinitionEntity> results = ListExt.ConvertToListT<ProcessDefinitionEntity>(DbEntityManager.SelectList("selectProcessDefinitionByKeyVersionAndTenantId", parameters));
            IList <ProcessDefinitionEntity> results =
                Find(
                    m =>
                    m.Key == processDefinitionKey && m.Version == (int)processDefinitionVersion &&
                    m.TenantId == tenantId)
                .ToList();

            if (results.Count == 1)
            {
                return(results[0]);
            }
            if (results.Count > 1)
            {
                throw Log.ToManyProcessDefinitionsException(results.Count, processDefinitionKey,
                                                            processDefinitionVersion, tenantId);
            }
            return(null);
        }