private string GetContragentCompanyNameIfApplicable(GLTran tran)
        {
            if (tran.ReferenceID != null)
            {
                int?defContactID;

                if (tran.Module == BatchModule.AP || tran.Module == BatchModule.PO)
                {
                    var vendor = _gafRepository.GetVendorsByIDs(tran.ReferenceID.SingleToArray())
                                 .Single();

                    defContactID = vendor.DefContactID;
                }
                else
                {
                    var customer = _gafRepository.GetCustomersByIDs(tran.ReferenceID.SingleToArray())
                                   .Single();

                    defContactID = customer.DefContactID;
                }

                var contact = _gafRepository.GetContact(defContactID);

                return(contact.FullName);
            }

            return(null);
        }