private Customer DbCustomerToCustomer(DMTDataRepositories.Database.Customer dbCust)
        {
            if (dbCust == null)
                return null;

            Customer c = new Customer();

            c.ID = dbCust.ID;
            c.FirstName = dbCust.FirstName;
            c.LastName = dbCust.LastName;
            c.EmailAddress = dbCust.EmailAddress;
            c.Address = dbCust.Address1;
            c.Address2 = dbCust.Address2;
            c.City = dbCust.City;
            c.State = dbCust.State;
            c.ZIPCode = dbCust.ZIPCode;
            c.FacebookUserID = dbCust.FacebookUserID;
            c.FacebookAccessToken = dbCust.FacebookAccessToken;
            c.FacebookExpires = dbCust.FacebookExpires;
            c.BillingID = dbCust.BillingID;
            c.Password = dbCust.Password;
            c.AvatarURL = dbCust.AvatarURL;

            if(dbCust.Type!=null) c.Type = (int)dbCust.Type;

            if(dbCust.BillingType!=null)
                c.BillingType = (int)dbCust.BillingType;

            return c;
        }
        private Challenge DbChallengeToChallenge(DMTDataRepositories.Database.Challenge dc)
        {
            Challenge c = new Challenge();

            c.ID = dc.ID;
            c.Title = dc.Title;
            c.Description = dc.Description;
            c.CurrentBid = (int)dc.CurrentBid;
            c.Privacy = (int)dc.Privacy;
            c.State = (int)dc.State;
            c.TargetCustomerID = (int)dc.TargetCustomerID;
            c.CustomerID = dc.CustomerID;

            try
            {
                c.Visibility = Convert.ToInt32(dc.Visibility);
            }
            catch (Exception ex)
            {
                c.Visibility = 0;
            }

            return c;
        }
        private ChallengeBid DbBidToBid(DMTDataRepositories.Database.Bid d)
        {
            ChallengeBid b = new ChallengeBid();

            b.Amount = d.Amount;
            b.ChallengeID = (long)d.ChallengeID;
            b.CustomerID = d.CustomerID;
            b.ID = d.ID;

            if (d.ComputedFees != null)
                b.ComputedFees = (decimal)d.ComputedFees;
            else
                b.ComputedFees = 0m;

            return b;
        }