public IHttpActionResult OfficeRegister(OfficeDetailsEntities office)
        {
            try
            {
                if (office.UserId != 0)
                {
                    office.IsActive       = true;
                    office.CreatedDate    = DateTime.Now;
                    office.UserId         = office.UserId;
                    office.OfficeLocation = office.City;
                    int OfficeId = userManager.OfficeDetails(office);
                    var location = office.City + " " + office.Country;
                    if (OfficeId > 0)
                    {
                        using (var client = new WebClient())
                        {
                            string       url       = "http://api.positionstack.com/v1/forward?access_key=284d4543eb91f4bd81dff5d9d7f52d07&query=" + location;
                            Stream       stream    = client.OpenRead(url);
                            StreamReader reader    = new StreamReader(stream);
                            JObject      jObject   = JObject.Parse(reader.ReadLine());
                            string       Latitude  = jObject["data"][0]["latitude"].ToString();
                            string       Longitude = jObject["data"][0]["longitude"].ToString();
                            userManager.AddLatLong(Latitude, Longitude, office.City);
                        }
                        UserRegistration ur = new UserRegistration();
                        ur                 = db.UserRegistrations.Find(office.UserId);
                        ur.OfficeId        = OfficeId;
                        db.Entry(ur).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        var          data     = db.UserRegistrations.Where(m => m.Id == office.UserId).FirstOrDefault();
                        string       FilePath = "D:\\CargovioProject\\Cargovio\\Common\\MailFormat\\OfficeRegistration.html";
                        StreamReader str      = new StreamReader(FilePath);
                        string       MailText = str.ReadToEnd();


                        DateTime time = DateTime.Now;

                        MailText = MailText.Replace("{UserName}", data.Username);
                        MailText = MailText.Replace("{City}", office.OfficeLocation);
                        str.Close();

                        MailMessage mail = new MailMessage();
                        mail.To.Add(data.Email);
                        mail.From    = new MailAddress("*****@*****.**");
                        mail.Subject = "Office Registration Success";
                        string Body = MailText;
                        mail.Body       = Body;
                        mail.IsBodyHtml = true;
                        SmtpClient smtp = new SmtpClient();
                        smtp.Host = "smtp.gmail.com";
                        smtp.Port = 587;
                        smtp.UseDefaultCredentials = false;
                        smtp.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "Password@123");
                        smtp.EnableSsl             = true;
                        smtp.Send(mail);
                        string Message = data.Username + " Our New Office In" + office.OfficeLocation + " Is Allocated With You";
                        sms.Send(data.ContactNo, Message);
                        return(Ok("Account Created Success!"));
                    }
                    else
                    {
                        UserRegistration ur = db.UserRegistrations.Find(office.UserId);
                        db.Entry(ur).State = System.Data.Entity.EntityState.Deleted;
                        db.SaveChanges();
                        return(Ok("Office Already Exists!"));
                    }
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                return(NotFound());
            }
        }