public ActionResult Create(ProfileInputModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Profile newProfile = new Profile()
                    {
                        ID = model.ID,
                        Username = model.Username,
                        Name = model.Name,
                        Surname = model.Surname,
                        Email = model.Email,
                        DateOfBirth = model.DateOfBirth,
                        Address = new Address() {
                            Street = model.Address.Street,
                            City = model.Address.City,
                            PostalCode = model.Address.PostalCode
                        },
                        Gender = model.Gender,
                        Description = model.Description
                    };

                    if (model.Photo != null)
                    {
                        int fileLength = model.Photo.ContentLength;
                        byte[] fileData = new byte[fileLength];
                        System.IO.Stream fileStream = model.Photo.InputStream;
                        fileStream.Read(fileData, 0, fileLength);

                        newProfile.Photo = fileData;
                        newProfile.PhotoMimeType = model.Photo.ContentType;
                        newProfile.PhotoSize = model.Photo.ContentLength;
                        newProfile.PhotoFilename = model.Photo.FileName;
                        newProfile.PhotoUploadedOn = DateTime.Now;
                    }

                    Guid id = _provider.Add(newProfile);

                    return RedirectToAction("Index");
                }
            }
            catch {}

            return View();
        }
        public ActionResult Edit(string id, ProfileInputModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Profile profile = _provider.GetProfileByID(Guid.Parse(id));

                    profile.Username = model.Username;
                    profile.Name = model.Name;
                    profile.Surname = model.Surname;
                    profile.Email = model.Email;
                    profile.DateOfBirth = model.DateOfBirth;
                    profile.Address = new Address()
                    {
                        Street = model.Address.Street,
                        City = model.Address.City,
                        PostalCode = model.Address.PostalCode
                    };
                    profile.Gender = model.Gender;
                    profile.Description = model.Description;

                    if (model.ChangePassword)
                    {
                        profile.Password = model.Password;
                        //profile.PasswordConfirmation = model.PasswordConfirmation;
                    }

                    if (model.Photo != null)
                    {
                        int fileLength = model.Photo.ContentLength;
                        byte[] fileData = new byte[fileLength];
                        System.IO.Stream fileStream = model.Photo.InputStream;
                        fileStream.Read(fileData, 0, fileLength);

                        profile.Photo = fileData;
                        profile.PhotoMimeType = model.Photo.ContentType;
                        profile.PhotoSize = model.Photo.ContentLength;
                        profile.PhotoFilename = model.Photo.FileName;
                        profile.PhotoUploadedOn = DateTime.Now;
                    }

                    _provider.Update(profile);

                    return RedirectToAction("Index");
                }
            }
            catch {}

            return View();
        }
        //
        // GET: /Profile/Edit/5
        public ActionResult Edit(string id)
        {
            Profile profile = _provider.GetProfileByID(Guid.Parse(id));

            ProfileInputModel model = new ProfileInputModel(profile);

            return View(model);
        }