public async Task<IHttpActionResult> EditStudentProfile(StudentEditDTO profile)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            string reg = User.Identity.GetUserId();

            Student client = await db.Students.Where(d => d.registrationId == reg).SingleOrDefaultAsync();
            if (client == null)
            {
                return StatusCode(HttpStatusCode.Forbidden);
            }


            

            Student student = new Student()
            {
                firstName= profile.first_name,
                middleName = profile.middle_name,
                lastName = profile.last_name,
                level = profile.level,
                category= profile.category,
                institute= profile.instituiton,
                phone = profile.phone_number,
                wallpaper = profile.wall_paper,
                linkdn = profile.linkdn_url,
                profilePic = profile.profile_pic,
                Id = client.Id
            };

            if (profile.level == 0)
            {
                student.level = client.level;
            }

            foreach (PropertyInfo propertyInfo in client.GetType().GetProperties())
            {
                if (propertyInfo.GetValue(student, null) == null)
                    propertyInfo.SetValue(student, propertyInfo.GetValue(client, null), null);
            }
            

            try
            {
                db.Entry(client).CurrentValues.SetValues(student);
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(client.Id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.OK);
        }
        public async Task<IHttpActionResult> StudentRegistration(StudentRegDTO data)
        {

            RegisterBindingModel model = new RegisterBindingModel
            {
                Email = data.email_address,
                Password = data.password,
                ConfirmPassword = data.confirm_password

            };
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }
            else
            {
                ApplicationUser client = await UserManager.FindByEmailAsync(model.Email);
                Student student = new Student()
                {
                    firstName= data.first_name,
                    middleName = data.middle_name,
                    lastName = data.last_name,
                    registrationId= client.Id,
                    category = data.category,
                    institute = data.institute,
                    email = data.email_address,
                    level = data.academic_level
                };

                db.Students.Add(student);
                await db.SaveChangesAsync();
            }
            return Ok();
        }