public static int?Create(ActionModel input)
        {
            CCSubmitDirect db = input.Database;

            // check prelander type
            int?prelandertypeid = CCSubmitCacheManager.GetPrelanderTypeID(input.PrelanderType);

            if (!prelandertypeid.HasValue)
            {
                return(null);
            }

            // check prelander
            int?prelanderid = CCSubmitCacheManager.GetPrelanderID(input.prelander, prelandertypeid.Value);

            if (!prelanderid.HasValue)
            {
                return(null);
            }

            // get lead id
            int?leadid = null;

            if (!string.IsNullOrEmpty(input.Msisdn) || !string.IsNullOrEmpty(input.Email))
            {
                leadid = LeadManager.GetLeadID(input.Msisdn, input.Email, db);
                if (!leadid.HasValue)
                {
                    leadid = LeadManager.CreateLead(input.Msisdn, input.Email, input.FirstName, input.LastName, input.Country, input.Address, input.City, input.Zip, input.device_model, input.carrier, input.device_mf, input.device_os, 1, db);
                }
                else
                {
                    db.Transactional.Execute("UPDATE [].tm_lead SET actions_count=actions_count+1 WHERE leadid={0};", leadid.Value);
                }
            }

            int?actionid = db.Execute("INSERT INTO [].tm_lead_action (leadid, prelandertypeid, prelanderid, host, request, referrer, ip, updated)",
                                      leadid, prelandertypeid.Value, prelanderid.Value, input.host, input.request, input.referrer, input.ipAddress, DirectTime.Now);

            return(actionid);
        }